Beispiel #1
0
 public function getProd($item_obj)
 {
     $comquick2cartHelper = new comquick2cartHelper();
     $currency = $comquick2cartHelper->getCurrencySession();
     $Quick2cartModelcart = new Quick2cartModelcart();
     if (empty($item_obj['item_id'])) {
         $item_id = $Quick2cartModelcart->getitemid($item_obj["id"], $item_obj['parent']);
     } else {
         $item_id = $item_obj['item_id'];
     }
     //	 $query = "SELECT parent,product_id,name,price FROM #__kart_items WHERE product_id = ".(int) $item_obj["id"]." AND parent='".$item_obj['parent']."'";
     $itemid_rec = $this->getItemRec($item_id);
     $params = JComponentHelper::getParams('com_quick2cart');
     $query = "SELECT kc.id as base_currency_id,kc.item_id,";
     if ($params->get('usedisc')) {
         $query .= " CASE WHEN kc.discount_price IS NOT NULL THEN kc.discount_price\n\t\t\t\tELSE kc.price\n\t\t\t\tEND as price, ";
     } else {
         $query .= " kc.price, ";
     }
     // removed parent and product_id
     $query .= " ki.name\n\t\tFROM #__kart_items AS ki\n\t\tLEFT JOIN  `#__kart_base_currency` AS kc\n\t\tON  `ki`.`item_id` =  `kc`.`item_id`\n\t\tWHERE ki.`item_id` =" . $itemid_rec->item_id . "\n\t\tAND kc.currency = '" . $currency . "'";
     // AND ki.parent='".$item_obj['parent']."'";
     $this->_db->setQuery($query);
     $item_result = $this->_db->loadAssoc();
     //$pid=(int) $item_obj["id"]; //product_id
     $item_result['price'] = $item_result['price'];
     $item_result["count"] = $item_obj["count"];
     // input to this f()
     $final_result[] = $item_result;
     // IF product has attributes
     if ($item_obj['options']) {
         //$query = "SELECT * FROM #__kart_itemattributeoptions WHERE itemattributeoption_id IN (".$item_obj['options'].")";//old query
         $query = "\n\t\t\tSELECT \tko.itemattributeoption_id,ko.itemattribute_id,ko.itemattributeoption_name,ko.itemattributeoption_code,ko.itemattributeoption_prefix,ko.ordering,\n\t\t\t currency as optioncurrency,price as optionprice\n\t\t\t FROM #__kart_itemattributeoptions as ko\n\t\t\t LEFT JOIN #__kart_option_currency as kc\n\t\t\t ON  `ko`.`itemattributeoption_id`=`kc`.`itemattributeoption_id`\n\t\t\t WHERE ko.itemattributeoption_id IN (" . $item_obj['options'] . ") AND currency='" . $currency . "'";
         $this->_db->setQuery($query);
         $options_result = $this->_db->loadAssocList();
         $item_options = array();
         foreach ($options_result as $options_result) {
             $item_options_arr[] = $options_result['itemattribute_id'];
             foreach ($options_result as $k => $v) {
                 $item_options[$options_result['itemattribute_id']][$k] = $v;
             }
         }
         $itemattribute_ids = implode(",", $item_options_arr);
         $final_result[] = $item_options;
         $query = "SELECT * FROM #__kart_itemattributes WHERE itemattribute_id IN (" . $itemattribute_ids . ")";
         $this->_db->setQuery($query);
         $item_attri = $this->_db->loadAssocList();
         $final_result[] = $item_attri;
     }
     return $final_result;
 }
Beispiel #2
0
			<button type="button" class="close" data-dismiss="alert"></button>
			<?php 
    $create_store_itemid = $comquick2cartHelper->getitemid('index.php?option=com_quick2cart&view=vendor&layout=createstore');
    $createstore = "<a href=\"" . JRoute::_('index.php?option=com_quick2cart&view=vendor&layout=createstore&Itemid=' . $create_store_itemid) . "\"> Click Here</a>";
    ?>
			<strong><?php 
    echo "<br>" . JText::sprintf('QTC_NO_STORE', $createstore);
    ?>
</strong>
		</div>
		<?php 
} else {
    JLoader::import('cart', JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models');
    $model = new Quick2cartModelcart();
    if (!empty($pid)) {
        $item_id = $model->getitemid($pid, $client);
    }
    /*fetch Minimum/ max /stock  item Quantity*/
    if (!empty($item_id)) {
        $minmaxstock = $model->getItemRec($item_id);
    }
    $class_nm = 'form-horizontal';
    if ($client === 'com_zoo') {
        $class_nm = '';
    }
    // If article is QTC product then show qtc fields.
    $showQtcFields = 'display:none;';
    if (!empty($itemDetail['item_id'])) {
        $showQtcFields = '';
    } else {
        ?>