本文整理汇总了PHP中producthelper::getProductById方法的典型用法代码示例。如果您正苦于以下问题:PHP producthelper::getProductById方法的具体用法?PHP producthelper::getProductById怎么用?PHP producthelper::getProductById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类producthelper
的用法示例。
在下文中一共展示了producthelper::getProductById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
$app = JFactory::getApplication();
$producthelper = new producthelper();
$pathway = $app->getPathway();
$document = JFactory::getDocument();
$user = JFactory::getUser();
// Preform security checks
if ($user->id == 0) {
echo JText::_('COM_REDSHOP_ALERTNOTAUTH_REVIEW');
return;
}
$model = $this->getModel('product_rating');
$userinfo = $model->getuserfullname($user->id);
$params = $app->getParams('com_redshop');
$Itemid = JRequest::getInt('Itemid');
$product_id = JRequest::getInt('product_id');
$category_id = JRequest::getInt('category_id');
$user = JFactory::getUser();
$model = $this->getModel('product_rating');
$rate = JRequest::getInt('rate');
$already_rated = $model->checkRatedProduct($product_id, $user->id);
if ($already_rated == 1) {
if ($rate == 1) {
$msg = JText::_('COM_REDSHOP_YOU_CAN_NOT_REVIEW_SAME_PRODUCT_AGAIN');
$link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $product_id . '&cid=' . $category_id . '&Itemid=' . $Itemid);
$app->redirect($link, $msg);
} else {
echo JText::_('COM_REDSHOP_YOU_CAN_NOT_REVIEW_SAME_PRODUCT_AGAIN');
?>
<span id="closewindow"><input type="button" value="Close Window" onclick="window.parent.redBOX.close();"/></span>
<script>
setTimeout("window.parent.redBOX.close();", 2000);
</script>
<?php
return;
}
}
$productinfo = $producthelper->getProductById($product_id);
$this->user = $user;
$this->userinfo = $userinfo;
$this->product_id = $product_id;
$this->rate = $rate;
$this->category_id = $category_id;
$this->productinfo = $productinfo;
$this->params = $params;
parent::display($tpl);
}
示例2: sendMailForReview
public function sendMailForReview($data)
{
$this->store($data);
$producthelper = new producthelper();
$redshopMail = new redshopMail();
$user = JFactory::getUser();
$url = JURI::base();
$option = JRequest::getVar('option');
$Itemid = JRequest::getVar('Itemid');
$mailbcc = null;
$fromname = $data['username'];
$from = $user->email;
$subject = "";
$message = $data['title'];
$comment = $data['comment'];
$username = $data['username'];
$product_id = $data['product_id'];
$mailbody = $redshopMail->getMailtemplate(0, "review_mail");
$data_add = $message;
if (count($mailbody) > 0) {
$data_add = $mailbody[0]->mail_body;
$subject = $mailbody[0]->mail_subject;
if (trim($mailbody[0]->mail_bcc) != "") {
$mailbcc = explode(",", $mailbody[0]->mail_bcc);
}
}
$product = $producthelper->getProductById($product_id);
$link = JRoute::_($url . "index.php?option=" . $option . "&view=product&pid=" . $product_id . '&Itemid=' . $Itemid);
$product_url = "<a href=" . $link . ">" . $product->product_name . "</a>";
$data_add = str_replace("{product_link}", $product_url, $data_add);
$data_add = str_replace("{product_name}", $product->product_name, $data_add);
$data_add = str_replace("{title}", $message, $data_add);
$data_add = str_replace("{comment}", $comment, $data_add);
$data_add = str_replace("{username}", $username, $data_add);
if (ADMINISTRATOR_EMAIL != "") {
$sendto = explode(",", ADMINISTRATOR_EMAIL);
if (JFactory::getMailer()->sendMail($from, $fromname, $sendto, $subject, $data_add, $mode = 1, null, $mailbcc)) {
return true;
} else {
return false;
}
}
}
示例3: sendProductMailToFriend
public function sendProductMailToFriend($your_name, $friend_name, $product_id, $email)
{
$producthelper = new producthelper();
$redshopMail = new redshopMail();
$url = JURI::base();
$option = JRequest::getVar('option');
$mailinfo = $redshopMail->getMailtemplate(0, "product");
$data_add = "";
$subject = "";
$mailbcc = null;
if (count($mailinfo) > 0) {
$data_add = $mailinfo[0]->mail_body;
$subject = $mailinfo[0]->mail_subject;
if (trim($mailinfo[0]->mail_bcc) != "") {
$mailbcc = explode(",", $mailinfo[0]->mail_bcc);
}
} else {
$data_add = "<p>Hi {friend_name} ,</p>\r\n<p>New Product : {product_name}</p>\r\n<p>{product_desc} Please check this link : {product_url}</p>\r\n<p> </p>\r\n<p> </p>";
$subject = "Send to friend";
}
$data_add = str_replace("{friend_name}", $friend_name, $data_add);
$data_add = str_replace("{your_name}", $your_name, $data_add);
$product = $producthelper->getProductById($product_id);
$data_add = str_replace("{product_name}", $product->product_name, $data_add);
$data_add = str_replace("{product_desc}", $product->product_desc, $data_add);
$rlink = JRoute::_($url . "index.php?option=" . $option . "&view=product&pid=" . $product_id);
$product_url = "<a href=" . $rlink . ">" . $rlink . "</a>";
$data_add = str_replace("{product_url}", $product_url, $data_add);
$config = JFactory::getConfig();
$from = $config->getValue('mailfrom');
$fromname = $config->getValue('fromname');
$subject = str_replace("{product_name}", $product->product_name, $subject);
$subject = str_replace("{shopname}", SHOP_NAME, $subject);
if ($email != "") {
if (JFactory::getMailer()->sendMail($from, $fromname, $email, $subject, $data_add, 1, null, $mailbcc)) {
echo "<div class='' align='center'>" . JText::_('COM_REDSHOP_EMAIL_HAS_BEEN_SENT_SUCCESSFULLY') . "</div>";
} else {
echo "<div class='' align='center'>" . JText::_('COM_REDSHOP_EMAIL_HAS_NOT_BEEN_SENT_SUCCESSFULLY') . "</div>";
}
}
exit;
}
示例4: getProductDetail
private static function getProductDetail($id)
{
$component = JComponentHelper::getComponent("com_redshop");
if (!isset($component->id)) {
JError::raiseError('500', 'redShop Component is not installed');
}
if (!defined('TABLE_PREFIX')) {
require_once JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshop.cfg.php';
}
require_once JPATH_SITE . '/components/com_redshop/helpers/helper.php';
$objhelper = new redhelper();
$producthelper = new producthelper();
$ItemData = $producthelper->getMenuInformation(0, 0, '', 'product&pid=' . $id);
if (count($ItemData) > 0) {
$pItemid = $ItemData->id;
} else {
$pItemid = $objhelper->getItemid($id);
}
$link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $id . '&Itemid=' . $pItemid);
$product = $producthelper->getProductById($id);
$product->product_price = $producthelper->getProductPrice($id);
$product->link = $link;
return $product;
}
示例5: extraField
} else {
$print_url = $url . "index.php?option=com_redshop&view=product&layout=compare&print=1&tmpl=component";
$print_tag = "<a href='#' onclick='window.open(\"{$print_url}\",\"mywindow\",\"scrollbars=1\",\"location=1\")' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' ><img src=" . JSYSTEM_IMAGES_PATH . "printButton.png alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' /></a>";
}
$template = str_replace("{print}", $print_tag, $template);
$template = str_replace('{compare_product_heading}', $pagetitle, $template);
$template = str_replace('{returntocategory_name}', JText::_("COM_REDSHOP_GO_BACK"), $template);
$template = str_replace('{returntocategory_link}', $returnlink, $template);
// Make extrafield object..
$field = new extraField();
$product_tag = array();
if (count($compare_template) > 0) {
$product_tag = $producthelper->product_tag($compare_template[0]->template_id, "1", $template);
}
for ($i = 0; $i < $compare['idx']; $i++) {
$product = $producthelper->getProductById($compare[$i]["product_id"]);
if ($i == $compare['idx'] - 1) {
$td_start = "";
$td_end = "";
} else {
$td_start = "<td>";
$td_end = "</td>";
}
$exp_div = "<div name='exp_" . $product->product_id . "'>";
$div_end = "</div>";
$link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $product->product_id . '&Itemid=' . $this->itemId);
$link_remove = JRoute::_('index.php?option=com_redshop&view=product&task=removecompare&layout=compare&pid=' . $product->product_id . '&Itemid=' . $this->itemId);
$remove = "<a href='" . $link_remove . "'>" . JText::_('TPL_REDGADGETS_REMOVE_PRODUCT_FROM_COMPARE_LIST') . "</a>";
$thumbUrl = RedShopHelperImages::getImagePath($product->product_full_image, '', 'thumb', 'product', COMPARE_PRODUCT_THUMB_WIDTH, COMPARE_PRODUCT_THUMB_HEIGHT, USE_IMAGE_SIZE_SWAPPING);
$img = "<div style='width:" . COMPARE_PRODUCT_THUMB_WIDTH . "px;height:" . COMPARE_PRODUCT_THUMB_HEIGHT . "px;float: left;' ><a href='" . $link . "' title='" . $product->product_name . "'><img src='" . $thumbUrl . "'></a></div>";
$expand = "<a href='javascript:void(0)' onClick='expand_collapse(this," . $product->product_id . ")' style='font-size:18px;text-decoration:none;' >-</a>";
示例6: sendAskQuestionMail
public function sendAskQuestionMail($ansid)
{
$producthelper = new producthelper();
$uri = JURI::getInstance();
$url = $uri->root();
$option = JRequest::getVar('option');
$subject = "";
$data_add = "";
$mailbcc = null;
$mailinfo = $this->getMailtemplate(0, "ask_question_mail");
$ans = $producthelper->getQuestionAnswer($ansid);
if (count($mailinfo) > 0) {
$data_add = $mailinfo[0]->mail_body;
$subject = $mailinfo[0]->mail_subject;
$mailbcc = explode(",", $mailinfo[0]->mail_bcc);
}
if (count($ans) > 0) {
$ans = $ans[0];
$fromname = $ans->user_name;
$from = $ans->user_email;
$email = explode(",", trim(ADMINISTRATOR_EMAIL));
$question = $ans->question;
$answer = "";
$telephone = "";
$address = "";
$product_id = $ans->product_id;
if ($ans->parent_id) {
$answer = $ans->question;
$qdetail = $producthelper->getQuestionAnswer($ans->parent_id);
if (count($qdetail) > 0) {
$config = JFactory::getConfig();
$from = $config->getValue('mailfrom');
$fromname = $config->getValue('fromname');
$qdetail = $qdetail[0];
$question = $qdetail->question;
$email = $qdetail->user_email;
$product_id = $qdetail->product_id;
$address = $qdetail->address;
$telephone = $qdetail->telephone;
}
}
$product = $producthelper->getProductById($product_id);
$link = JRoute::_($url . "index.php?option=" . $option . "&view=product&pid=" . $product_id);
$data_add = str_replace("{product_name}", $product->product_name, $data_add);
$data_add = str_replace("{product_desc}", $product->product_desc, $data_add);
$product_url = "<a href=" . $link . ">" . $product->product_name . "</a>";
$data_add = str_replace("{product_link}", $product_url, $data_add);
$data_add = str_replace("{user_question}", $question, $data_add);
$data_add = str_replace("{answer}", $answer, $data_add);
$data_add = str_replace("{user_address}", $address, $data_add);
$data_add = str_replace("{user_telephone}", $telephone, $data_add);
$subject = str_replace("{user_question}", $question, $subject);
$subject = str_replace("{shopname}", SHOP_NAME, $subject);
$subject = str_replace("{product_name}", $product->product_name, $subject);
if ($email) {
if (JUtility::sendMail($from, $fromname, $email, $subject, $data_add, $mode = 1, null, $mailbcc)) {
return true;
}
}
}
return false;
}
示例7: save
public function save($apply = 0)
{
$post = JRequest::get('post');
$adminproducthelper = new adminproducthelper();
$order_functions = new order_functions();
$shippinghelper = new shipping();
$option = JRequest::getVar('option', '', 'request', 'string');
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
$post['order_id'] = $cid[0];
$model = $this->getModel('addorder_detail');
$post['order_number'] = $order_number = $order_functions->generateOrderNumber();
$orderItem = $adminproducthelper->redesignProductItem($post);
$post['order_item'] = $orderItem;
// Check product Quantity
$stocknote = '';
if (USE_STOCKROOM == 1) {
$stockroomhelper = new rsstockroomhelper();
$producthelper = new producthelper();
for ($i = 0; $i < count($orderItem); $i++) {
$quantity = $orderItem[$i]->quantity;
$productData = $producthelper->getProductById($orderItem[$i]->product_id);
if ($productData->min_order_product_quantity > 0 && $productData->min_order_product_quantity > $quantity) {
$msg = $productData->product_name . " " . JText::_('WARNING_MSG_MINIMUM_QUANTITY');
$stocknote .= sprintf($msg, $productData->min_order_product_quantity) . "<br/>";
$quantity = $productData->min_order_product_quantity;
}
$currentStock = $stockroomhelper->getStockroomTotalAmount($orderItem[$i]->product_id);
$finalquantity = $currentStock >= $quantity ? (int) $quantity : (int) $currentStock;
if ($finalquantity > 0) {
if ($productData->max_order_product_quantity > 0 && $productData->max_order_product_quantity < $finalquantity) {
$msg = $productData->product_name . " " . JText::_('WARNING_MSG_MAXIMUM_QUANTITY') . "<br/>";
$stocknote .= sprintf($msg, $productData->max_order_product_quantity);
$finalquantity = $productData->max_order_product_quantity;
}
$orderItem[$i]->quantity = $finalquantity;
} else {
$stocknote .= $productData->product_name . " " . JText::_('PRODUCT_OUT_OF_STOCK') . "<br/>";
unset($orderItem[$i]);
}
}
$orderItem = array_merge(array(), $orderItem);
if (count($orderItem) <= 0) {
$msg = JText::_('PRODUCT_OUT_OF_STOCK');
$this->setRedirect('index.php?option=' . $option . '&view=addorder_detail&user_id=' . $post['user_id'] . '&shipping_users_info_id=' . $post['shipp_users_info_id'], $msg);
return;
}
}
$order_total = $post['order_total'];
$order_shipping = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $post['shipping_rate_id'])));
if (count($order_shipping) > 4) {
$post['order_shipping'] = $order_shipping[3];
$order_total = $order_total + $order_shipping[3];
$post['order_shipping_tax'] = $order_shipping[6];
}
$tmporder_total = $order_total;
if (array_key_exists("issplit", $post) && $post['issplit']) {
$tmporder_total = $order_total / 2;
}
$paymentmethod = $order_functions->getPaymentMethodInfo($post['payment_method_class']);
$paymentmethod = $paymentmethod[0];
$paymentparams = new JRegistry($paymentmethod->params);
$paymentinfo = new stdclass();
$post['economic_payment_terms_id'] = $paymentparams->get('economic_payment_terms_id');
$post['economic_design_layout'] = $paymentparams->get('economic_design_layout');
$paymentinfo->payment_price = $paymentparams->get('payment_price', '');
$paymentinfo->is_creditcard = $post['economic_is_creditcard'] = $paymentparams->get('is_creditcard', '');
$paymentinfo->payment_oprand = $paymentparams->get('payment_oprand', '');
$paymentinfo->accepted_credict_card = $paymentparams->get("accepted_credict_card");
$paymentinfo->payment_discount_is_percent = $paymentparams->get('payment_discount_is_percent', '');
$cartHelper = new rsCartHelper();
$subtotal = $post['order_subtotal'];
$update_discount = 0;
if ($post['update_discount'] > 0) {
$update_discount = $post['update_discount'];
if ($update_discount > $subtotal) {
$update_discount = $subtotal;
}
if ($update_discount != 0) {
$order_total = $order_total - $update_discount;
}
}
$special_discount = $post['special_discount'];
$subtotal_excl_vat = 0;
for ($i = 0; $i < count($orderItem); $i++) {
$subtotal_excl_vat = $subtotal_excl_vat + $orderItem[$i]->prdexclprice * $orderItem[$i]->quantity;
}
if (APPLY_VAT_ON_DISCOUNT) {
$amt = $subtotal;
} else {
$amt = $subtotal_excl_vat;
}
$discount_price = $amt * $special_discount / 100;
$post['special_discount'] = $special_discount;
$post['special_discount_amount'] = $discount_price;
$order_total = $order_total - $discount_price;
if (PAYMENT_CALCULATION_ON == 'subtotal') {
$paymentAmount = $subtotal;
} else {
$paymentAmount = $order_total;
}
//.........这里部分代码省略.........
示例8: store
public function store($data)
{
$extra_field = new extra_field();
$quotationHelper = new quotationHelper();
$producthelper = new producthelper();
$rsCarthelper = new rsCarthelper();
$stockroomhelper = new rsstockroomhelper();
$extra_field->extra_field_save($data, 16, $data['user_info_id'], $data['user_email']);
$row = $this->getTable('quotation_detail');
if ($data['quotation_discount'] > 0) {
$data['order_total'] = $data['order_total'] - $data['quotation_discount'] - $data['order_total'] * $data['quotation_special_discount'] / 100;
}
$data['quotation_number'] = $quotationHelper->generateQuotationNumber();
$data['quotation_encrkey'] = $quotationHelper->randomQuotationEncrkey();
$data['quotation_cdate'] = time();
$data['quotation_mdate'] = time();
$data['quotation_total'] = $data['order_total'];
$data['quotation_subtotal'] = $data['order_subtotal'];
$data['quotation_tax'] = $data['order_tax'];
$data['quotation_ipaddress'] = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'unknown';
if (!$row->bind($data)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
$row->quotation_status = 2;
if (!$row->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
$quotation_item = array();
$user_id = $row->user_id;
$item = $data['order_item'];
for ($i = 0; $i < count($item); $i++) {
$product_id = $item[$i]->product_id;
$quantity = $item[$i]->quantity;
$product_excl_price = $item[$i]->prdexclprice;
$product_price = $item[$i]->productprice;
// Attribute price added
$generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id);
$retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity);
$product_attribute = $retAttArr[0];
// Accessory price
$generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id);
$retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id);
$product_accessory = $retAccArr[0];
$wrapper_price = 0;
$wrapper_vat = 0;
$wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data);
if (count($wrapper) > 0) {
if ($wrapper[0]->wrapper_price > 0) {
$wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id);
}
$wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat;
}
$rowitem =& $this->getTable('quotation_item_detail');
$product = $producthelper->getProductById($product_id);
$quotation_item[$i]->quotation_id = $row->quotation_id;
$quotation_item[$i]->product_id = $product_id;
$quotation_item[$i]->is_giftcard = 0;
$quotation_item[$i]->product_name = $product->product_name;
$quotation_item[$i]->actualitem_price = $product_price;
$quotation_item[$i]->product_price = $product_price;
$quotation_item[$i]->product_excl_price = $product_excl_price;
$quotation_item[$i]->product_final_price = $product_price * $quantity;
$quotation_item[$i]->product_attribute = $product_attribute;
$quotation_item[$i]->product_accessory = $product_accessory;
$quotation_item[$i]->product_wrapperid = $item[$i]->wrapper_data;
$quotation_item[$i]->wrapper_price = $wrapper_price;
$quotation_item[$i]->product_quantity = $quantity;
if (!$rowitem->bind($quotation_item[$i])) {
$this->setError($this->_db->getErrorMsg());
return false;
}
if (!$rowitem->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Store userfields
$userfields = JRequest::getVar('extrafields' . $product_id);
$userfields_id = JRequest::getVar('extrafields_id_' . $product_id);
for ($ui = 0; $ui < count($userfields); $ui++) {
$quotationHelper->insertQuotationUserfield($userfields_id[$ui], $rowitem->quotation_item_id, 12, $userfields[$ui]);
}
/** my accessory save in table start */
if (count($generateAccessoryCart) > 0) {
$attArr = $generateAccessoryCart;
for ($a = 0; $a < count($attArr); $a++) {
$accessory_vat_price = 0;
$accessory_attribute = "";
$accessory_id = $attArr[$a]['accessory_id'];
$accessory_name = $attArr[$a]['accessory_name'];
$accessory_price = $attArr[$a]['accessory_price'];
$accessory_org_price = $accessory_price;
if ($accessory_price > 0) {
$accessory_vat_price = $producthelper->getProductTax($rowitem->product_id, $accessory_price, $user_id);
}
$attchildArr = $attArr[$a]['accessory_childs'];
for ($j = 0; $j < count($attchildArr); $j++) {
$attribute_id = $attchildArr[$j]['attribute_id'];
$accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>";
//.........这里部分代码省略.........
示例9: store
//.........这里部分代码省略.........
}
}
$shippingaddresses = $shippingaddresses[$key];
}
// ORDER DELIVERY TIME IS REMAINING
$user_id = $row->user_id;
$item = $postdata['order_item'];
for ($i = 0; $i < count($item); $i++) {
$product_id = $item[$i]->product_id;
$quantity = $item[$i]->quantity;
$product_excl_price = $item[$i]->prdexclprice;
$product_price = $item[$i]->productprice;
// Attribute price added
$generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id);
$retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity);
$product_attribute = $retAttArr[0];
// Accessory price
$generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id);
$retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id);
$product_accessory = $retAccArr[0];
$accessory_total_price = $retAccArr[1];
$accessory_vat_price = $retAccArr[2];
$wrapper_price = 0;
$wrapper_vat = 0;
if ($item[$i]->wrapper_data != 0 && $item[$i]->wrapper_data != '') {
$wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data);
if (count($wrapper) > 0) {
if ($wrapper[0]->wrapper_price > 0) {
$wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id);
}
$wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat;
}
}
$product = $producthelper->getProductById($product_id);
$rowitem =& $this->getTable('order_item_detail');
if (!$rowitem->bind($postdata)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// STOCKROOM update
$updatestock = $stockroomhelper->updateStockroomQuantity($product_id, $quantity);
$stockroom_id_list = $updatestock['stockroom_list'];
$stockroom_quantity_list = $updatestock['stockroom_quantity_list'];
$rowitem->stockroom_id = $stockroom_id_list;
$rowitem->stockroom_quantity = $stockroom_quantity_list;
$rowitem->order_item_id = 0;
$rowitem->order_id = $row->order_id;
$rowitem->user_info_id = $row->user_info_id;
$rowitem->supplier_id = $product->manufacturer_id;
$rowitem->product_id = $product_id;
$rowitem->order_item_sku = $product->product_number;
$rowitem->order_item_name = $product->product_name;
$rowitem->product_quantity = $quantity;
$rowitem->product_item_price = $product_price;
$rowitem->product_item_price_excl_vat = $product_excl_price;
$rowitem->product_final_price = $product_price * $quantity;
$rowitem->order_item_currency = REDCURRENCY_SYMBOL;
$rowitem->order_status = $row->order_status;
$rowitem->cdate = $row->cdate;
$rowitem->mdate = $row->cdate;
$rowitem->product_attribute = $product_attribute;
$rowitem->product_accessory = $product_accessory;
$rowitem->wrapper_id = $item[$i]->wrapper_data;
$rowitem->wrapper_price = $wrapper_price;
$rowitem->is_giftcard = 0;
// RedCRM product purchase price
示例10: getProductItemInfo
public function getProductItemInfo($product_id = 0, $quantity = 1, $unique_id = "", $user_id = 0, $newproduct_price = 0)
{
$producthelper = new producthelper();
$wrapperlist = "";
$accessorylist = "";
$attributelist = "";
$productuserfield = "";
$product_price = 0;
$product_price_excl_vat = 0;
$producttax = 0;
if ($product_id) {
$productInfo = $producthelper->getProductById($product_id);
if ($newproduct_price != 0) {
$product_price_excl_vat = $newproduct_price;
$producttax = $producthelper->getProductTax($product_id, $newproduct_price, $user_id);
} else {
$productArr = $producthelper->getProductNetPrice($product_id, $user_id, $quantity);
$product_price_excl_vat = $productArr['productPrice'];
$producttax = $productArr['productVat'];
// Attribute start
$attributes_set = array();
if ($productInfo->attribute_set_id > 0) {
$attributes_set = $producthelper->getProductAttribute(0, $productInfo->attribute_set_id, 0, 1);
}
$attributes = $producthelper->getProductAttribute($product_id);
$attributes = array_merge($attributes, $attributes_set);
$attributelist = $this->replaceAttributeData($product_id, 0, $attributes, $user_id, $unique_id);
// Accessory start
$accessory = $producthelper->getProductAccessory(0, $product_id);
$accessorylist = $this->replaceAccessoryData($product_id, $accessory, $user_id, $unique_id);
// Wrapper selection box generate
$wrapperlist = $this->replaceWrapperData($product_id, $user_id, $unique_id);
$productuserfield = $this->replaceUserfield($product_id, $productInfo->product_template, $unique_id);
}
}
$product_price = $product_price_excl_vat + $producttax;
$total_price = $product_price * $quantity;
$totaltax = $producttax * $quantity;
$displayrespoce = "";
$displayrespoce .= "<div id='product_price_excl_vat'>" . $product_price_excl_vat . "</div>";
$displayrespoce .= "<div id='product_tax'>" . $producttax . "</div>";
$displayrespoce .= "<div id='product_price'>" . $product_price . "</div>";
$displayrespoce .= "<div id='total_price'>" . $total_price . "</div>";
$displayrespoce .= "<div id='total_tax'>" . $totaltax . "</div>";
$displayrespoce .= "<div id='attblock'><table>" . $attributelist . "</table></div>";
$displayrespoce .= "<div id='productuserfield'><table>" . $productuserfield . "</table></div>";
$displayrespoce .= "<div id='accessoryblock'><table>" . $accessorylist . "</table></div>";
$displayrespoce .= "<div id='noteblock'>" . $wrapperlist . "</div>";
return $displayrespoce;
}
示例11: producthelper
$producthelper = new producthelper();
$uri = JURI::getInstance();
$url = $uri->root();
// For Add Media Detail
$showbuttons = JRequest::getCmd('showbuttons');
$media_section = JRequest::getCmd('media_section');
$section_id = JRequest::getCmd('section_id');
$model = $this->getModel('media');
$sectionadata = array();
$sectiona_primary_image = "";
$section_name = "";
$directory = $media_section;
if ($showbuttons == 1) {
switch ($media_section) {
case "product":
$sectionadata = $producthelper->getProductById($section_id);
$section_name = $sectionadata->product_name;
$sectiona_primary_image = $sectionadata->product_full_image;
$directory = $media_section;
break;
case "property":
$sectionadata = $producthelper->getAttibuteProperty($section_id);
$section_name = $sectionadata[0]->property_name;
$sectiona_primary_image = $sectionadata[0]->property_main_image;
$directory = 'property';
break;
case "subproperty":
$sectionadata = $producthelper->getAttibuteSubProperty($section_id);
$section_name = $sectionadata[0]->subattribute_color_name;
$sectiona_primary_image = $sectionadata[0]->subattribute_color_main_image;
$directory = 'subproperty';
示例12: rsCarthelper
$output = '<div class="mod_cart_extend_total_pro_value" id="mod_cart_total_txt_product" >';
$output .= JText::_('COM_REDSHOP_TOTAL_PRODUCT') . ':' . ' ' . $cartTotalProduct . ' ' . JText::_('COM_REDSHOP_PRODUCTS_IN_CART');
$output .= '</div>';
}
break;
case 'extended':
$output = '<div class="mod_cart_products" id="mod_cart_products">';
if ($count) {
$cartTotalProduct = $idx;
for ($i = 0; $i < $idx; $i++) {
$carthelper = new rsCarthelper();
if ($carthelper->rs_multi_array_key_exists('giftcard_id', $cart[$i]) && $cart[$i]['giftcard_id']) {
$giftcardData = $producthelper->getGiftcardData($cart[$i]['giftcard_id']);
$name = $giftcardData->giftcard_name;
} else {
$product_detail = $producthelper->getProductById($cart[$i]['product_id']);
$name = $product_detail->product_name;
}
$output .= '<div class="mod_cart_product">';
$output .= '<div class="mod_cart_product_name">' . $name . ' x ' . $cart[$i]['quantity'] . '</div>';
if (!DEFAULT_QUOTATION_MODE || DEFAULT_QUOTATION_MODE && SHOW_QUOTATION_PRICE) {
$output .= '<div class="mod_cart_product_price">';
if ($show_with_vat) {
$output .= $producthelper->getProductFormattedPrice($cart[$i]['product_price'], true);
} else {
$output .= $producthelper->getProductFormattedPrice($cart[$i]['product_price_excl_vat'], true);
}
$output .= '</div>';
}
$output .= '</div>';
}
示例13: neworderitem
public function neworderitem($data, $quantity, $order_item_id)
{
$adminproducthelper = new adminproducthelper();
$producthelper = new producthelper();
$rsCarthelper = new rsCarthelper();
$stockroomhelper = new rsstockroomhelper();
// Get Order Info
$orderdata = $this->getTable('order_detail');
$orderdata->load($this->_id);
$item = $data['order_item'];
// Get product Info
// Set Order Item Info
$orderitemdata = $this->getTable('order_item_detail');
$orderitemdata->load($order_item_id);
$user_id = $orderdata->user_id;
for ($i = 0; $i < count($item); $i++) {
$product_id = $item[$i]->product_id;
$product_excl_price = $item[$i]->prdexclprice;
$product_price = $item[$i]->productprice;
// Attribute price added
$generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id);
$retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity);
$product_attribute = $retAttArr[0];
// Accessory price
$generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id);
$retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id);
$product_accessory = $retAccArr[0];
$wrapper_price = 0;
$wrapper_vat = 0;
if ($item[$i]->wrapper_data != 0 && $item[$i]->wrapper_data != '') {
$wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data);
if (count($wrapper) > 0) {
if ($wrapper[0]->wrapper_price > 0) {
$wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id);
}
$wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat;
}
}
$product = $producthelper->getProductById($product_id);
$updatestock = $stockroomhelper->updateStockroomQuantity($product_id, $quantity);
$stockroom_id_list = $updatestock['stockroom_list'];
$stockroom_quantity_list = $updatestock['stockroom_quantity_list'];
$orderitemdata->stockroom_id = $stockroom_id_list;
$orderitemdata->stockroom_quantity = $stockroom_quantity_list;
$orderitemdata->order_item_id = 0;
$orderitemdata->order_id = $this->_id;
$orderitemdata->user_info_id = $orderdata->user_info_id;
$orderitemdata->supplier_id = $product->manufacturer_id;
$orderitemdata->product_id = $product_id;
$orderitemdata->order_item_sku = $product->product_number;
$orderitemdata->order_item_name = $product->product_name;
$orderitemdata->product_quantity = $quantity;
$orderitemdata->product_item_price = $product_price;
$orderitemdata->product_item_price_excl_vat = $product_excl_price;
$orderitemdata->product_final_price = $product_price * $quantity;
$orderitemdata->order_item_currency = REDCURRENCY_SYMBOL;
$orderitemdata->order_status = "P";
$orderitemdata->cdate = time();
$orderitemdata->mdate = time();
$orderitemdata->product_attribute = $product_attribute;
$orderitemdata->product_accessory = $product_accessory;
$orderitemdata->wrapper_id = $item[$i]->wrapper_data;
$orderitemdata->wrapper_price = $wrapper_price;
if ($producthelper->checkProductDownload($product_id)) {
$medianame = $producthelper->getProductMediaName($product_id);
for ($j = 0; $j < count($medianame); $j++) {
$sql = "INSERT INTO " . $this->_table_prefix . "product_download " . "(product_id, user_id, order_id, end_date, download_max, download_id, file_name) " . "VALUES('" . $product_id . "', '" . $user_id . "', '" . $this->_id . "', " . "'" . (time() + PRODUCT_DOWNLOAD_DAYS * 23 * 59 * 59) . "', '" . PRODUCT_DOWNLOAD_LIMIT . "', " . "'" . md5(uniqid(mt_rand(), true)) . "', '" . $medianame[$j]->media_name . "')";
$this->_db->setQuery($sql);
$this->_db->query();
}
}
if (!$orderitemdata->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
/** my accessory save in table start */
if (count($generateAccessoryCart) > 0) {
$attArr = $generateAccessoryCart;
for ($a = 0; $a < count($attArr); $a++) {
$accessory_vat_price = 0;
$accessory_attribute = "";
$accessory_id = $attArr[$a]['accessory_id'];
$accessory_name = $attArr[$a]['accessory_name'];
$accessory_price = $attArr[$a]['accessory_price'];
$accessory_org_price = $accessory_price;
if ($accessory_price > 0) {
$accessory_vat_price = $producthelper->getProductTax($product_id, $accessory_price, $user_id);
}
$attchildArr = $attArr[$a]['accessory_childs'];
for ($j = 0; $j < count($attchildArr); $j++) {
$attribute_id = $attchildArr[$j]['attribute_id'];
$accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>";
$rowattitem =& $this->getTable('order_attribute_item');
$rowattitem->order_att_item_id = 0;
$rowattitem->order_item_id = $orderitemdata->order_item_id;
$rowattitem->section_id = $attribute_id;
$rowattitem->section = "attribute";
$rowattitem->parent_section_id = $accessory_id;
$rowattitem->section_name = $attchildArr[$j]['attribute_name'];
$rowattitem->is_accessory_att = 1;
//.........这里部分代码省略.........
示例14: producthelper
* @subpackage View
*
* @copyright Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
require_once JPATH_COMPONENT_SITE . '/helpers/product.php';
$producthelper = new producthelper();
$option = JRequest::getVar('option');
$model = $this->getModel('answer_detail');
$editor = JFactory::getEditor();
$uri = JURI::getInstance();
$url = $uri->root();
$product = $producthelper->getProductById($this->qdetail->product_id);
?>
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function (pressbutton) {
submitbutton(pressbutton);
}
submitbutton = function (pressbutton) {
var form = document.adminForm;
if (pressbutton == 'cancel') {
submitform(pressbutton);
return;
}
submitform(pressbutton);
示例15:
for ($i = 0; $i < count($quotationProducts); $i++) {
$cart_mdata .= $template_middle;
$wrapper_name = "";
if ($quotationProducts[$i]->product_wrapperid) {
$wrapper = $producthelper->getWrapper($quotationProducts[$i]->product_id, $quotationProducts[$i]->product_wrapperid);
if (count($wrapper) > 0) {
$wrapper_name = JText::_('COM_REDSHOP_WRAPPER') . ":<br/>" . $wrapper[0]->wrapper_name . "(" . $producthelper->getProductFormattedPrice($quotationProducts[$i]->wrapper_price) . ")";
}
}
if ($quotationProducts[$i]->is_giftcard == 1) {
$product_userfields = $quotationHelper->displayQuotationUserfield($quotationProducts[$i]->quotation_item_id, 13);
$giftcardData = $producthelper->getGiftcardData($quotationProducts[$i]->product_id);
$product_number = "";
} else {
$product_userfields = $quotationHelper->displayQuotationUserfield($quotationProducts[$i]->quotation_item_id, 12);
$product = $producthelper->getProductById($quotationProducts[$i]->product_id);
$product_number = $product->product_number;
$product_image_path = "";
if ($product->product_full_image) {
if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . $product->product_full_image)) {
$product_image_path = $product->product_full_image;
} else {
if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . PRODUCT_DEFAULT_IMAGE)) {
$product_image_path = PRODUCT_DEFAULT_IMAGE;
}
}
} else {
if (is_file(REDSHOP_FRONT_IMAGES_RELPATH . "product/" . PRODUCT_DEFAULT_IMAGE)) {
$product_image_path = PRODUCT_DEFAULT_IMAGE;
}
}