当前位置: 首页>>代码示例>>PHP>>正文


PHP comquick2cartHelper::getSoreID方法代码示例

本文整理汇总了PHP中comquick2cartHelper::getSoreID方法的典型用法代码示例。如果您正苦于以下问题:PHP comquick2cartHelper::getSoreID方法的具体用法?PHP comquick2cartHelper::getSoreID怎么用?PHP comquick2cartHelper::getSoreID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在comquick2cartHelper的用法示例。


在下文中一共展示了comquick2cartHelper::getSoreID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addSaveOrderItems

 function addSaveOrderItems($insert_order_id, $cart_itemsdata, $data, $updateOrderstatus)
 {
     $productHelper = new productHelper();
     // GET BILLING AND SHIPPING ADDRESS
     $bill = $data->get('bill', array(), "ARRAY");
     $ship = $data->get('ship', array(), "ARRAY");
     $comquick2cartHelper = new comquick2cartHelper();
     $data->set('order_id', $insert_order_id);
     // row_id= last insert id
     $store_info = array();
     $itemsTaxDetail = $data->get('itemsTaxDetail', array(), 'ARRAY');
     $itemShipMethDetail = $data->get('itemShipMethDetail', array(), 'ARRAY');
     foreach ($cart_itemsdata as $cart_items) {
         $item_id = $cart_items['item_id'];
         $taxdetail = '';
         $shipdetail = '';
         // Get item tax detail
         if (!empty($itemsTaxDetail[$item_id])) {
             // Get current item tax detail
             $taxdetail = $itemsTaxDetail[$item_id];
         }
         // Get item ship detail
         if (!empty($itemShipMethDetail[$item_id])) {
             // Get current item tax detail
             $shipdetail = $itemShipMethDetail[$item_id];
         }
         $items = new stdClass();
         $items->order_id = $insert_order_id;
         $items->item_id = $item_id;
         // Getting store id from item_id
         $items->store_id = $comquick2cartHelper->getSoreID($cart_items['item_id']);
         $items->product_attributes = $cart_items['product_attributes'];
         $items->product_attribute_names = $cart_items['options'];
         $items->order_item_name = $cart_items['title'];
         $items->product_quantity = $cart_items['qty'];
         $items->product_item_price = $cart_items['amt'];
         $items->product_attributes_price = $cart_items['opt_amt'];
         // This field store price without cop, tax,shipp etc
         //~ $originalProdPrice = ($items->product_item_price + $items->product_attributes_price ) * $items->product_quantity;
         //~ $items->original_price = isset($cart_items['original_price']) ? $cart_items['original_price'] : $originalProdPrice;
         $items->original_price = $cart_items['original_price'];
         $items->item_tax = !empty($taxdetail['taxAmount']) ? $taxdetail['taxAmount'] : 0;
         $items->item_tax_detail = !empty($taxdetail) ? json_encode($taxdetail) : '';
         $items->item_shipcharges = !empty($shipdetail['totalShipCost']) ? $shipdetail['totalShipCost'] : 0;
         $items->item_shipDetail = !empty($shipdetail) ? json_encode($shipdetail) : '';
         $items->product_final_price = $cart_items['tamt'] + $items->item_tax + $items->item_shipcharges;
         $items->params = $cart_items['params'];
         $items->cdate = date("Y-m-d H:i:s");
         //$cart_items['cdate'];
         $items->mdate = date("Y-m-d H:i:s");
         //$cart_items['mdate'];
         $items->status = 'P';
         if (!$this->_db->insertObject('#__kart_order_item', $items, 'order_item_id')) {
             echo $this->_db->stderr();
             return 0;
         }
         // Add entry in order_itemattributes
         $query = "Select *\n\t\t\t FROM #__kart_cartitemattributes\n\t\t\t WHERE cart_item_id=" . (int) $cart_items['id'];
         // cart_item_id as id
         $this->_db->setQuery($query);
         $cartresult = $this->_db->loadAssocList();
         if (!empty($cartresult)) {
             foreach ($cartresult as $key => $cart_itemopt) {
                 $items_opt = new stdClass();
                 $items_opt->order_item_id = $items->order_item_id;
                 $items_opt->itemattributeoption_id = $cart_itemopt['itemattributeoption_id'];
                 $items_opt->orderitemattribute_name = $cart_itemopt['cartitemattribute_name'];
                 $attopprice = $this->getAttrOptionPrice($cart_itemopt['itemattributeoption_id']);
                 $items_opt->orderitemattribute_price = $attopprice;
                 $items_opt->orderitemattribute_prefix = $cart_itemopt['cartitemattribute_prefix'];
                 if (!$this->_db->insertObject('#__kart_order_itemattributes', $items_opt, 'orderitemattribute_id')) {
                     echo $this->_db->stderr();
                     return 0;
                 }
             }
         }
         $params = JComponentHelper::getParams('com_quick2cart');
         $socialintegration = $params->get('integrate_with', 'none');
         $streamBuyProd = $params->get('streamBuyProd', 0);
         //$libclass = new activityintegrationstream();
         if ($streamBuyProd && $socialintegration != 'none') {
             // adding msg in stream
             $user = JFactory::getUser();
             $action = 'buyproduct';
             $prodLink = '<a class="" href="' . $comquick2cartHelper->getProductLink($cart_items['item_id']) . '">' . $cart_items['title'] . '</a>';
             $store_info[$items->store_id] = $comquick2cartHelper->getSoreInfo($items->store_id);
             $storeLink = '<a class="" href="' . JUri::root() . substr(JRoute::_('index.php?option=com_quick2cart&view=vendor&layout=store&store_id=' . $items->store_id), strlen(JUri::base(true)) + 1) . '">' . $store_info[$items->store_id]['title'] . '</a>';
             $originalMsg = JText::sprintf('QTC_ACTIVITY_BUY_PROD', $prodLink, $storeLink);
             $title = '{actor} ' . $originalMsg;
             // According to integration create social lib class obj.
             $libclass = $comquick2cartHelper->getQtcSocialLibObj();
             $libclass->pushActivity($user->id, $act_type = '', $act_subtype = '', $originalMsg, $act_link = '', $title = '', $act_access = '');
         }
         if (0) {
             // add to JS stream
             if (JFile::exists(JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php')) {
                 @$comquick2cartHelper->addJSstream($user->id, $user->id, $title, '', $action, 0);
                 require_once JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
                 $userid = JFactory::getUser()->id;
                 if ($userid) {
//.........这里部分代码省略.........
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:cartcheckout.php

示例2: putCartitem

 /**
  * This method check whether user bought the product or not.
  *
  * @param   integer  $c_id          cart id.
  * @param   array    $cartitem      items detail 0=> array of basic info,1=>selection option info. 2=> attribute info.
  * @param   integer  $cart_item_id  cart item id while updating the cart from checkout view.
  *
  * @since   2.2.2
  *
  * @return   boolean true or false.
  */
 public function putCartitem($c_id, $cartitem, $cart_item_id = '')
 {
     $comquick2cartHelper = new comquick2cartHelper();
     $params = JComponentHelper::getParams('com_quick2cart');
     $item_details = $cartitem[0];
     // Option details size->big,medium
     $item_options = isset($cartitem[1]) ? $cartitem[1] : null;
     // Attribute details
     $item_attris = isset($cartitem[2]) ? $cartitem[2] : null;
     if (!$c_id) {
         $c_id = $this->getCartId();
     }
     // Get current item store id.
     $currItemStoreId = $comquick2cartHelper->getSoreID($item_details['item_id']);
     $singleStoreCkout = $params->get('singleStoreCkout', 0);
     if ($singleStoreCkout) {
         $status = $this->isProdFromSameStore($c_id, $currItemStoreId);
         // If not from same store.
         if (!$status) {
             return 2;
         }
     }
     $timestamp = date("Y-m-d H:i:s");
     $opt_price = 0;
     $opt = $opt_ids = '';
     $matchAttr = 1;
     // Product has attributes.
     if ($item_attris) {
         foreach ($item_attris as $item_attri) {
             $item_option = $item_options[$item_attri['itemattribute_id']];
             $opt .= $item_attri['itemattribute_name'] . ": " . $item_option['itemattributeoption_name'] . ",";
             $opt_ids .= $item_option['itemattributeoption_id'] . ",";
             if ($item_option['itemattributeoption_prefix'] == '+') {
                 $opt_price += $item_option['optionprice'];
             } elseif ($item_option['itemattributeoption_prefix'] == '-') {
                 $opt_price -= $item_option['optionprice'];
             }
         }
         // Trim last comma,
         //$opt_ids = rtrim($opt_ids, ',');
     }
     $query = "Select cart_item_id,item_id,product_quantity\n\t\t FROM #__kart_cartitems WHERE cart_id=" . (int) $c_id . " AND item_id=" . $item_details['item_id'] . " AND product_attributes='" . $opt_ids . "' AND `product_attribute_names` = '" . $opt . "'";
     $this->_db->setQuery($query);
     $cart = $this->_db->loadAssoc();
     //~ $cart = $this->_db->loadAssocList();
     //~ print"<pre>"; print_r($cartitem);
     //~ print"<pre>"; print_r($cart); die;
     $final_price = $item_details['price'] + $opt_price;
     $items = new stdClass();
     $items->product_final_price = $item_details['count'] * $final_price;
     $items->product_item_price = $item_details['price'];
     $items->product_attributes = $opt_ids;
     $items->product_attribute_names = $opt;
     $items->product_attributes_price = $opt_price;
     $items->mdate = $timestamp;
     $items->currency = $comquick2cartHelper->getCurrencySession();
     $items->store_id = $comquick2cartHelper->getSoreID($item_details['item_id']);
     // getting store id from item_id
     //~ if (!empty($params))
     //~ {
     //~ $items->params = $params;
     //~ }
     /* if #__kart_cartitems contain entry then update .if cart contain item then  update// check  present  same && all attr same  */
     if ($cart['cart_item_id'] && $cart['item_id'] == $item_details['item_id']) {
         //~ print"<pre>"; print $cart_item_id;
         //~ print"<pre>"; print_r($cart);
         //~ print"<pre>"; print_r($item_details);
         //~ die;
         // Just clicking on refresh button
         if ($cart_item_id && $cart['cart_item_id'] == $cart_item_id) {
             $final_qty = $item_details['count'];
         } else {
             $final_qty = $cart['product_quantity'] + $item_details['count'];
         }
         $minmax = $comquick2cartHelper->getMinMax($item_details['item_id']);
         // not equal to nulll,0 etc
         if (!empty($minmax['min_quantity']) && !empty($minmax['max_quantity'])) {
             if ($final_qty < $minmax['min_quantity'] || $final_qty > $minmax['max_quantity'] || $cart['product_quantity'] < 1) {
                 return JText::sprintf('COM_QUICK2CART_MIN_MAX_ERROR_SUD_BE_INRANGE', $minmax['min_quantity'], $minmax['max_quantity']);
                 "";
             }
         }
         $slabquantity = $item_details['count'] % $minmax['slab'];
         if ($slabquantity != 0) {
             return JText::sprintf('COM_QUICK2CART_QUANTITY_SHOULD_BE_MULI_OF_SLAB', $minmax['slab']);
         }
         $items->product_quantity = $final_qty;
         $items->cart_item_id = $cart['cart_item_id'];
         $items->product_final_price = $items->product_quantity * $final_price;
//.........这里部分代码省略.........
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:cart.php


注:本文中的comquick2cartHelper::getSoreID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。