Пример #1
0
 public static function getTaxProfileId($product_id)
 {
     $row = K2StorePrices::getProduct($product_id);
     return $row->item_tax_id;
 }
Пример #2
0
 public static function getItemInfo($id)
 {
     static $itemsets;
     if (!is_array($itemsets)) {
         $itemsets = array();
     }
     if (!isset($itemsets[$id])) {
         $db = JFactory::getDBO();
         $query = "SELECT * FROM #__k2_items WHERE id=" . $id;
         $db->setQuery($query);
         $row = $db->loadObject();
         //get k2store variables
         $product = K2StorePrices::getProduct($row->id);
         $item = $product;
         $item->product_id = $row->id;
         $item->product_name = $row->title;
         //
         $item->price = $product->item_price;
         $item->product_sku = $product->item_sku;
         $item->tax_profile_id = $product->item_tax_id;
         $item->item_shipping = $product->item_shipping;
         $item->item_cart_text = $product->item_cart_text;
         //we need item metrics so load info from the products table
         //TODO: Why cant we load all k2store data from this table itself
         $item->item_minimum = isset($product->item_minimum) ? $product->item_minimum : '1';
         //get the stock data and assign to it
         $store_config = K2StoreHelperCart::getStoreAddress();
         if ($item->use_store_config_min_out_qty > 0) {
             $item->min_out_qty = (double) $store_config->store_min_out_qty;
         }
         if ($item->use_store_config_min_sale_qty > 0) {
             $item->min_sale_qty = (double) $store_config->store_min_sale_qty;
         }
         if ($item->use_store_config_max_sale_qty > 0) {
             $item->max_sale_qty = (double) $store_config->store_max_sale_qty;
         }
         if ($item->use_store_config_notify_qty > 0) {
             $item->notify_qty = (double) $store_config->store_notify_qty;
         }
         $item->stock = $item;
         $item->product = $row;
         $itemsets[$id] = $item;
     }
     return $itemsets[$id];
 }