本文整理汇总了PHP中producthelper::getProductTax方法的典型用法代码示例。如果您正苦于以下问题:PHP producthelper::getProductTax方法的具体用法?PHP producthelper::getProductTax怎么用?PHP producthelper::getProductTax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类producthelper
的用法示例。
在下文中一共展示了producthelper::getProductTax方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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/>";
//.........这里部分代码省略.........
示例2: 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;
}
示例3: addtocart
public function addtocart($data = array())
{
$app = JFactory::getApplication();
$Itemid = JRequest::getVar("Itemid");
$session = JFactory::getSession();
$db = JFactory::getDbo();
$carthelper = new rsCarthelper();
$producthelper = new producthelper();
$quotationHelper = new quotationHelper();
$cart = $session->get('cart');
$idx = (int) $cart['idx'];
$row_data = $quotationHelper->getQuotationUserfield($data->quotation_item_id);
$quotation_acc_data = $quotationHelper->getQuotationItemAccessoryDetail($data->quotation_item_id);
$quotation_att_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 0, "attribute", $data->product_id);
// Set session for giftcard
if ($data->is_giftcard == 1) {
if ($carthelper->rs_recursiveArraySearch($cart, $data->product_id)) {
$cart[$idx]['quantity'] += 1;
$session->set('cart', $cart);
return;
} else {
$cart[$idx]['quantity'] = 1;
}
$cart[$idx]['quantity'] = $data->product_quantity;
$cart[$idx]['giftcard_id'] = $data->product_id;
$cart[$idx]['product_price'] = $data->product_price;
$cart[$idx]['product_vat'] = 0;
$cart[$idx]['product_id'] = '';
$cart['discount_type'] = 0;
$cart['discount'] = 0;
$cart['discount2'] = 0;
$cart['reciver_email'] = '';
$cart['reciver_name'] = '';
for ($i = 0; $i < count($row_data); $i++) {
$field_name = $row_data[$i]->field_name;
$cart[$idx][$field_name] = $row_data[$i]->data_txt;
}
$cart['idx'] = $idx + 1;
$session->set('cart', $cart);
return;
}
$cart[$idx]['product_id'] = $data->product_id;
$cart[$idx]['product_price'] = $data->product_price;
$cart[$idx]['quantity'] = $data->product_quantity;
if ($data->product_excl_price) {
$getprotax = $producthelper->getProductTax($cart[$idx]['product_id'], $data->product_excl_price);
$cart[$idx]['product_price'] = $data->product_excl_price + $getprotax;
$cart[$idx]['product_price'] += $data->wrapper_price;
$cart[$idx]['product_subtotal'] = $cart[$idx]['quantity'] * $cart[$idx]['product_price'];
}
$generateAccessoryCart = array();
for ($i = 0; $i < count($quotation_acc_data); $i++) {
$generateAccessoryCart[$i]['accessory_id'] = $quotation_acc_data[$i]->accessory_id;
$generateAccessoryCart[$i]['accessory_name'] = $quotation_acc_data[$i]->accessory_item_name;
$generateAccessoryCart[$i]['accessory_oprand'] = "+";
$generateAccessoryCart[$i]['accessory_price'] = $quotation_acc_data[$i]->accessory_price;
$acc_att_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 1, "attribute", $quotation_acc_data[$i]->accessory_id);
$accAttributeCart = array();
for ($ia = 0; $ia < count($acc_att_data); $ia++) {
$accPropertyCart = array();
$accAttributeCart[$ia]['attribute_id'] = $acc_att_data[$ia]->section_id;
$accAttributeCart[$ia]['attribute_name'] = $acc_att_data[$ia]->section_name;
$acc_prop_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 1, "property", $acc_att_data[$ia]->section_id);
for ($ip = 0; $ip < count($acc_prop_data); $ip++) {
$accSubpropertyCart = array();
$accPropertyCart[$ip]['property_id'] = $acc_prop_data[$ip]->section_id;
$accPropertyCart[$ip]['property_name'] = $acc_prop_data[$ip]->section_name;
$accPropertyCart[$ip]['property_oprand'] = $acc_prop_data[$ip]->section_oprand;
$acc_subpro_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 1, "subproperty", $acc_prop_data[$ip]->section_id);
for ($isp = 0; $isp < count($acc_subpro_data); $isp++) {
$accSubpropertyCart[$isp]['subproperty_id'] = $acc_subpro_data[$isp]->section_id;
$accSubpropertyCart[$isp]['subproperty_name'] = $acc_subpro_data[$isp]->section_name;
$accSubpropertyCart[$isp]['subproperty_oprand'] = $acc_subpro_data[$isp]->section_oprand;
}
$accPropertyCart[$ip]['property_childs'] = $accSubpropertyCart;
}
$accAttributeCart[$ia]['attribute_childs'] = $accPropertyCart;
}
$generateAccessoryCart[$i]['accessory_childs'] = $accAttributeCart;
}
$generateAttributeCart = array();
for ($ia = 0; $ia < count($quotation_att_data); $ia++) {
$accPropertyCart = array();
$generateAttributeCart[$ia]['attribute_id'] = $quotation_att_data[$ia]->section_id;
$generateAttributeCart[$ia]['attribute_name'] = $quotation_att_data[$ia]->section_name;
$acc_prop_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 0, "property", $quotation_att_data[$ia]->section_id);
for ($ip = 0; $ip < count($acc_prop_data); $ip++) {
$accSubpropertyCart = array();
$accPropertyCart[$ip]['property_id'] = $acc_prop_data[$ip]->section_id;
$accPropertyCart[$ip]['property_name'] = $acc_prop_data[$ip]->section_name;
$accPropertyCart[$ip]['property_oprand'] = $acc_prop_data[$ip]->section_oprand;
$acc_subpro_data = $quotationHelper->getQuotationItemAttributeDetail($data->quotation_item_id, 0, "subproperty", $acc_prop_data[$ip]->section_id);
for ($isp = 0; $isp < count($acc_subpro_data); $isp++) {
$accSubpropertyCart[$isp]['subproperty_id'] = $acc_subpro_data[$isp]->section_id;
$accSubpropertyCart[$isp]['subproperty_name'] = $acc_subpro_data[$isp]->section_name;
$accSubpropertyCart[$isp]['subproperty_oprand'] = $acc_subpro_data[$isp]->section_oprand;
}
$accPropertyCart[$ip]['property_childs'] = $accSubpropertyCart;
}
$generateAttributeCart[$ia]['attribute_childs'] = $accPropertyCart;
//.........这里部分代码省略.........
示例4: getQuotationPriceTax
public function getQuotationPriceTax()
{
$producthelper = new producthelper();
$get = JRequest::get('get');
$product_id = $get['product_id'];
$user_id = $get['user_id'];
$newprice = $get['newprice'];
$vatprice = 0;
if ($newprice > 0) {
$vatprice = $producthelper->getProductTax($product_id, $newprice, $user_id);
}
echo "<div id='newtax'>" . $vatprice . "</div>";
exit;
}
示例5: store
//.........这里部分代码省略.........
$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
if ($iscrm) {
$crmProductHelper = new crmProductHelper();
$crmproduct = $crmProductHelper->getProductById($product_id);
$rowitem->product_purchase_price = $crmproduct->product_purchase_price > 0 ? $crmproduct->product_purchase_price : $crmproduct->product_price;
}
if ($producthelper->checkProductDownload($product_id)) {
$medianame = $producthelper->getProductMediaName($product_id);
for ($j = 0; $j < count($medianame); $j++) {
$product_serial_number = $producthelper->getProdcutSerialNumber($product_id);
$producthelper->insertProductDownload($product_id, $user_id, $rowitem->order_id, $medianame[$j]->media_name, $product_serial_number->serial_number);
}
}
if (!$rowitem->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 = $rowitem->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;
if ($attribute_id > 0) {
if (!$rowattitem->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
}
$propArr = $attchildArr[$j]['attribute_childs'];
for ($k = 0; $k < count($propArr); $k++) {
$section_vat = 0;
if ($propArr[$k]['property_price'] > 0) {
$section_vat = $producthelper->getProducttax($product_id, $propArr[$k]['property_price'], $user_id);
}
$property_id = $propArr[$k]['property_id'];
$accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>";
$subpropArr = $propArr[$k]['property_childs'];
$rowattitem =& $this->getTable('order_attribute_item');
$rowattitem->order_att_item_id = 0;
$rowattitem->order_item_id = $rowitem->order_item_id;
$rowattitem->section_id = $property_id;
示例6: updateItem
public function updateItem($data)
{
$producthelper = new producthelper();
$order_functions = new order_functions();
$stockroomhelper = new rsstockroomhelper();
$order_item_id = $data['order_item_id'];
$orderitemdata = $this->getTable('order_item_detail');
$orderitemdata->load($order_item_id);
$orderdata = $this->getTable('order_detail');
$orderdata->load($this->_id);
$order_id = $this->_id;
$product_id = $orderitemdata->product_id;
$currentStock = $stockroomhelper->getStockroomTotalAmount($product_id);
$user_id = $orderdata->user_id;
$productPrice = $data['update_price'];
$productPrice_new = 0;
if ($productPrice < 0) {
$productPrice_new = $productPrice;
$productPrice = $productPrice * -1;
}
$customer_note = $data['customer_note'];
$product_tax = $producthelper->getProductTax($product_id, $productPrice, $user_id);
if ($productPrice_new < 0) {
$product_tax = $product_tax * -1;
$productPrice = $productPrice_new;
}
$new_added_qty = $data['quantity'] - $orderitemdata->product_quantity;
if ($currentStock >= $new_added_qty || USE_STOCKROOM == 0) {
$quantity = (int) $data['quantity'];
} else {
$quantity = (int) $orderitemdata->product_quantity;
}
$product_item_price = $productPrice + $product_tax;
$product_item_price_excl_vat = $productPrice;
$product_final_price = $product_item_price * $quantity;
$productTotalTax = $product_tax * $quantity;
$subtotal = $product_item_price * $quantity;
$OrderItems = $order_functions->getOrderItemDetail($order_id);
$totalTax = $product_tax * $quantity;
for ($i = 0; $i < count($OrderItems); $i++) {
if ($order_item_id != $OrderItems[$i]->order_item_id) {
$itemtax = $OrderItems[$i]->product_item_price - $OrderItems[$i]->product_item_price_excl_vat;
$totalTax = $totalTax + $itemtax * $OrderItems[$i]->product_quantity;
$subtotal = $subtotal + $OrderItems[$i]->product_item_price * $OrderItems[$i]->product_quantity;
}
if ($order_item_id == $OrderItems[$i]->order_item_id) {
$newquantity = $OrderItems[$i]->product_quantity - $quantity;
if ($newquantity > 0) {
$stockroomhelper->manageStockAmount($product_id, $newquantity, $orderitemdata->stockroom_id);
} elseif ($newquantity < 0) {
$updatestock = $stockroomhelper->updateStockroomQuantity($product_id, -$newquantity);
$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;
}
$this->updateAttributeItem($order_item_id, $newquantity, $orderitemdata->stockroom_id);
}
}
$total = $subtotal + $orderdata->order_shipping - abs($orderdata->order_discount);
$orderitemdata->product_item_price = $product_item_price;
$orderitemdata->product_item_price_excl_vat = $product_item_price_excl_vat;
$orderitemdata->product_final_price = $product_final_price;
$orderitemdata->product_quantity = $quantity;
$orderitemdata->customer_note = $customer_note;
$orderdata->order_tax = $totalTax;
$orderdata->order_total = $total;
$orderdata->order_subtotal = $subtotal;
if ($orderitemdata->store()) {
if (!$orderdata->store()) {
return false;
}
$tmpArr['special_discount'] = $orderdata->special_discount;
$this->special_discount($tmpArr, true);
} else {
return false;
}
$order_functions->update_status();
return true;
}
示例7: store
public function store($data, $post)
{
$this->_loadData();
$quotationHelper = new quotationHelper();
$producthelper = new producthelper();
$extra_field = new extra_field();
$user = JFactory::getUser();
$user_id = 0;
$user_info_id = 0;
$user_email = $post['user_email'];
if ($user->id) {
$user_id = $user->id;
$user_info_id = $this->_data->user_info_id;
$user_email = $user->email;
}
$res = $this->getUserIdByEmail($user_email);
if (count($res) > 0) {
$user_id = $res->user_id;
$user_info_id = $res->users_info_id;
}
$list_field = $extra_field->extra_field_save($post, 16, $user_info_id, $user_email);
$data['quotation_number'] = $quotationHelper->generateQuotationNumber();
$data['user_id'] = $user_id;
$data['user_info_id'] = $user_info_id;
$data['user_email'] = $user_email;
$data['quotation_total'] = $data['total'];
$data['quotation_subtotal'] = $data['subtotal'];
$data['quotation_tax'] = $data['tax'];
$data['quotation_status'] = 1;
$data['quotation_cdate'] = time();
$data['quotation_mdate'] = time();
$data['quotation_note'] = $data['quotation_note'];
$data['quotation_ipaddress'] = $_SERVER['REMOTE_ADDR'];
$data['quotation_encrkey'] = $quotationHelper->randomQuotationEncrkey();
$data['quotation_discount'] = isset($data['discount2']) ? $data['discount2'] : 0;
$totalitem = $data['idx'];
$quotation_item = array();
$row = $this->getTable('quotation_detail');
if (!$row->bind($data)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
if (!$row->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
for ($i = 0; $i < $totalitem; $i++) {
$rowitem = $this->getTable('quotation_item_detail');
$quotation_item[$i] = new stdClass();
$quotation_item[$i]->quotation_id = $row->quotation_id;
if (isset($data[$i]['giftcard_id']) && $data[$i]['giftcard_id'] != 0) {
$quotation_item[$i]->product_id = $data[$i]['giftcard_id'];
$giftcardData = $producthelper->getGiftcardData($data[$i]['giftcard_id']);
$quotation_item[$i]->is_giftcard = 1;
$quotation_item[$i]->product_name = $giftcardData->giftcard_name;
$section = 13;
} else {
$product = $producthelper->getProductById($data[$i]['product_id']);
$retAttArr = $producthelper->makeAttributeCart($data[$i]['cart_attribute'], $data[$i]['product_id'], 0, 0, $data[$i]['quantity']);
$cart_attribute = $retAttArr[0];
$retAccArr = $producthelper->makeAccessoryCart($data[$i]['cart_accessory'], $data[$i]['product_id']);
$cart_accessory = $retAccArr[0];
$quotation_item[$i]->product_id = $data[$i]['product_id'];
$quotation_item[$i]->is_giftcard = 0;
$quotation_item[$i]->product_name = $product->product_name;
$quotation_item[$i]->actualitem_price = $data[$i]['product_price'];
$quotation_item[$i]->product_price = $data[$i]['product_price'];
$quotation_item[$i]->product_excl_price = $data[$i]['product_price_excl_vat'];
$quotation_item[$i]->product_final_price = $data[$i]['product_price'] * $data[$i]['quantity'];
$quotation_item[$i]->product_attribute = $cart_attribute;
$quotation_item[$i]->product_accessory = $cart_accessory;
$quotation_item[$i]->product_wrapperid = $data[$i]['wrapper_id'];
$quotation_item[$i]->wrapper_price = $data[$i]['wrapper_price'];
$section = 12;
}
$quotation_item[$i]->product_quantity = $data[$i]['quantity'];
if (!$rowitem->bind($quotation_item[$i])) {
$this->setError($this->_db->getErrorMsg());
return false;
}
if (!$rowitem->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
/** my accessory save in table start */
if (count($data[$i]['cart_accessory']) > 0) {
$attArr = $data[$i]['cart_accessory'];
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);
}
$attchildArr = $attArr[$a]['accessory_childs'];
for ($j = 0; $j < count($attchildArr); $j++) {
$attribute_id = $attchildArr[$j]['attribute_id'];
//.........这里部分代码省略.........
示例8: foreach
if (count($MyTags) > 0) {
foreach ($MyTags as $row) {
$data_add = '<div style="float:left;width:' . (THUMB_WIDTH + 50) . 'px;height:' . (THUMB_HEIGHT + 70) . 'px;text-align:center;">';
$thum_image = "";
$pname = $row->product_name;
$link = JRoute::_('index.php?option=com_redshop&view=product&pid=' . $row->product_id . '&Itemid=' . $Itemid);
if ($row->product_full_image) {
$thumbUrl = RedShopHelperImages::getImagePath($row->product_full_image, '', 'thumb', 'product', THUMB_WIDTH, THUMB_HEIGHT, USE_IMAGE_SIZE_SWAPPING);
$thum_image = "<div style='width:" . THUMB_WIDTH . "px;height:" . THUMB_HEIGHT . "px;margin-left:20px;' ><a href='" . $link . "' title=''><img src='" . $thumbUrl . "'></a></div>";
$data_add .= $thum_image;
}
$pname = "<div ><a href='" . $link . "' >" . $pname . "</a></div>";
$data_add .= $pname;
// For attribute price count
$price_add = '<span id="pr_price">' . $extra_data->getProductFormattedPrice($row->product_price) . '</span>';
$tax_amount = $extra_data->getProductTax($row->product_id);
if ($tax_amount == 0) {
$data_add .= '<div>' . $price_add . '</div>';
} else {
$data_add .= '<div>' . $extra_data->getProductFormattedPrice($tax_amount) . '</div>';
}
// Start cart
$tax_amount == 0 ? $product_price = $row->product_price : ($product_price = $tax_amount);
$data_add .= "<div><form name='addtocartscroll" . $i . "' id='addtocartscroll" . $i . "' action='' method='post' >\n\t\t\t\t\t\t\t\t\t\t<input type='hidden' value='" . $row->product_id . "' name='product_id'>\n\t\t\t\t\t\t\t\t\t\t<input type='hidden' value='cart' name='view'>\n\t\t\t\t\t\t\t\t\t\t<input type='hidden' value='add' name='task'>\n\t\t\t\t\t\t\t\t\t\t<input type='hidden' name='product_price' value='" . $product_price . "'>\n\t\t\t\t\t\t\t\t\t\t<input type='hidden' name='quantity' id='quantity" . $row->product_id . "' value='1'>\n\t\t\t\t\t\t\t\t\t\t<span onclick='document.addtocartscroll" . $i . ".submit();' align='center' style='background-image:url(" . REDSHOP_FRONT_IMAGES_ABSPATH . ADDTOCART_BACKGROUND . ");border:1px solid #183a5c;background-position:bottom;background-repeat:no-repeat;cursor:pointer;'><span style='cursor: pointer;' >" . JText::_('COM_REDSHOP_ADD_TO_CART') . "</span></span>\n\t\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t\t\t\t</div>";
$i++;
$data_add .= '</div>';
echo $data_add;
}
} else {
echo "<div>" . JText::_('COM_REDSHOP_NO_PRODUCTS_IN_TAGS') . "</div>";
}
示例9:
$unq = 1;
for ($i = 0; $i < count($quotation_item); $i++) {
$quo =& $quotation_item[$i];
if ($quo->is_giftcard == 1) {
$giftcardData = $producthelper->getGiftcardData($quo->product_id);
$actual_price = $giftcardData->giftcard_price;
$product_number = "";
$section = 13;
} else {
$product = $producthelper->getProductById($quo->product_id);
$actual_price = $product->product_price;
$product_number = "<br/>" . JText::_('COM_REDSHOP_PRODUCT_NUMBER') . ": ( " . $product->product_number . " ) ";
$section = 12;
$vat = 0;
if ($quo->product_excl_price > 0) {
$vat = $producthelper->getProductTax($quo->product_id, $quo->product_excl_price, $quotation->user_id);
}
$quo->product_price = $quo->product_excl_price + $vat;
}
$product_userfield = $quotationHelper->displayQuotationUserfield($quo->quotation_item_id, $section);
$product_attribute = "<br/>" . $producthelper->makeAttributeQuotation($quo->quotation_item_id, 0, $quo->product_id);
$product_accessory = "<br/>" . $producthelper->makeAccessoryQuotation($quo->quotation_item_id);
$wrapper_name = "";
if ($quo->product_wrapperid) {
$wrapper = $producthelper->getWrapper($quo->product_id, $quo->product_wrapperid);
if (count($wrapper) > 0) {
$wrapper_name = $wrapper[0]->wrapper_name . " (" . $producthelper->getProductFormattedPrice($quo->wrapper_price) . ")";
}
}
$product_title = $quo->product_name . $product_number . $product_attribute . $product_accessory . $product_userfield;
$product_total = $quo->product_price * $quo->product_quantity;
示例10: newQuotationItem
public function newQuotationItem($data)
{
$quotationHelper = new quotationHelper();
$rsCarthelper = new rsCarthelper();
$producthelper = new producthelper();
$stockroomhelper = new rsstockroomhelper();
$item = $data['quotation_item'];
// Get Order Info
$quotationdata = $this->getTable('quotation_detail');
$quotationdata->load($this->_id);
$user_id = $quotationdata->user_id;
// Set Order Item Info
$qitemdata = $this->getTable('quotation_item_detail');
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;
$product = $producthelper->getProductById($product_id);
$generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id);
$retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity);
$product_attribute = $retAttArr[0];
$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;
}
$qitemdata =& $this->getTable('quotation_item_detail');
$qitemdata->quotation_item_id = 0;
$qitemdata->quotation_id = $this->_id;
$qitemdata->product_id = $product_id;
$qitemdata->is_giftcard = 0;
$qitemdata->product_name = $product->product_name;
$qitemdata->actualitem_price = $product_price;
$qitemdata->product_price = $product_price;
$qitemdata->product_excl_price = $product_excl_price;
$qitemdata->product_final_price = $product_price * $quantity;
$qitemdata->product_attribute = $product_attribute;
$qitemdata->product_accessory = $product_accessory;
$qitemdata->product_wrapperid = $item[$i]->wrapper_data;
$qitemdata->wrapper_price = $wrapper_price;
$qitemdata->product_quantity = $quantity;
if (!$qitemdata->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($qitemdata->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('quotation_attribute_item');
$rowattitem->quotation_att_item_id = 0;
$rowattitem->quotation_item_id = $qitemdata->quotation_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;
if ($attribute_id > 0) {
if (!$rowattitem->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
}
$propArr = $attchildArr[$j]['attribute_childs'];
for ($k = 0; $k < count($propArr); $k++) {
$section_vat = 0;
if ($propArr[$k]['property_price'] > 0) {
$section_vat = $producthelper->getProducttax($qitemdata->product_id, $propArr[$k]['property_price'], $user_id);
}
$property_id = $propArr[$k]['property_id'];
$accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>";
$subpropArr = $propArr[$k]['property_childs'];
$rowattitem =& $this->getTable('quotation_attribute_item');
$rowattitem->quotation_att_item_id = 0;
$rowattitem->quotation_item_id = $qitemdata->quotation_item_id;
$rowattitem->section_id = $property_id;
$rowattitem->section = "property";
$rowattitem->parent_section_id = $attribute_id;
$rowattitem->section_name = $propArr[$k]['property_name'];
//.........这里部分代码省略.........