예제 #1
0
파일: view.html.php 프로젝트: A-Bush/pprod
 function display($tpl = null)
 {
     //run the update if auto update is enabled
     require_once JPATH_SITE . '/components/com_k2store/helpers/cart.php';
     $storeprofile = K2StoreHelperCart::getStoreAddress();
     if ($storeprofile->config_currency_auto) {
         $model = $this->getModel('currencies');
         $model->updateCurrencies();
     }
     // Get data from the model
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // inturn calls getState in parent class and populateState() in model
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     //add toolbar
     $this->addToolBar();
     $toolbar = new K2StoreToolBar();
     $toolbar->renderLinkbar();
     // Display the template
     parent::display($tpl);
     $this->setDocument();
 }
예제 #2
0
파일: currency.php 프로젝트: A-Bush/pprod
 function save($key = null, $urlVar = null)
 {
     if (parent::save($key = null, $urlVar = null)) {
         require_once JPATH_SITE . '/components/com_k2store/helpers/cart.php';
         $storeprofile = K2StoreHelperCart::getStoreAddress();
         if ($storeprofile->config_currency_auto) {
             $model = $this->getModel('currencies');
             $model->updateCurrencies(true);
         }
     }
 }
예제 #3
0
파일: cpanel.php 프로젝트: A-Bush/pprod
 public function checkCurrency()
 {
     $db = JFactory::getDbo();
     require_once JPATH_SITE . '/components/com_k2store/helpers/cart.php';
     $storeProfile = K2StoreHelperCart::getStoreAddress();
     //first check if the currency table has a default records at least.
     $query = $db->getQuery(true)->select('*')->from('#__k2store_currency');
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     if (count($rows) < 1) {
         //no records found. Dumb default data
         JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_k2store/tables');
         $item = JTable::getInstance('Currency', 'Table');
         $item->currency_title = 'US Dollar';
         $item->currency_code = 'USD';
         $item->currency_position = 'pre';
         $item->currency_symbol = '$';
         $item->currency_num_decimals = '2';
         $item->currency_decimal = '.';
         $item->currency_thousands = ',';
         $item->currency_value = '1.00000';
         //default currency is one always
         $item->currency_modified = JFactory::getDate()->toSql();
         $item->state = 1;
         $item->store();
     }
     $query = $db->getQuery(true)->select('*')->from('#__k2store_currency')->where('currency_value=' . $db->q('1.00000'));
     $db->setQuery($query);
     try {
         $currency = $db->loadObject();
     } catch (Exception $e) {
         //do nothing
     }
     //if currency is empty, set it
     if (empty($storeProfile->config_currency) || JString::strlen($storeProfile->config_currency) < 3) {
         if ($currency) {
             $sql = $db->getQuery(true)->update('#__k2store_storeprofiles')->set('config_currency=' . $db->q($currency->currency_code))->where('store_id=' . $db->q($storeProfile->store_id));
             $db->setQuery($sql);
             $db->execute();
         }
     }
     return true;
 }
예제 #4
0
파일: currency.php 프로젝트: A-Bush/pprod
 public function __construct()
 {
     require_once JPATH_SITE . '/components/com_k2store/helpers/cart.php';
     $storeprofile = K2StoreHelperCart::getStoreAddress();
     $this->config = $storeprofile;
     $this->session = JFactory::getSession();
     $this->input = JFactory::getApplication()->input;
     $rows = self::getCurrencyList();
     foreach ($rows as $result) {
         $this->currencies[$result['currency_code']] = $result;
     }
     $currency = $this->input->get('currency');
     if (isset($currency) && array_key_exists($currency, $this->currencies)) {
         $this->set($currency);
     } elseif ($this->session->has('currency', 'k2store') && array_key_exists($this->session->get('currency', '', 'k2store'), $this->currencies)) {
         $this->set($this->session->get('currency', '', 'k2store'));
     } else {
         $this->set($this->config->config_currency);
     }
 }
예제 #5
0
파일: tax.php 프로젝트: A-Bush/pprod
 public function __construct()
 {
     $app = JFactory::getApplication();
     $config = JComponentHelper::getParams('com_k2store');
     $session = JFactory::getSession();
     $storeAddress = K2StoreHelperCart::getStoreAddress();
     if ($session->has('shipping_country_id', 'k2store') || $session->has('shipping_zone_id', 'k2store')) {
         $this->setShippingAddress($session->get('shipping_country_id', '', 'k2store'), $session->get('shipping_zone_id', '', 'k2store'));
     } elseif ($config->get('config_tax_default') == 'shipping') {
         $this->setShippingAddress($storeAddress->country_id, $storeAddress->zone_id);
     }
     if ($session->has('billing_country_id', 'k2store') || $session->has('billing_zone_id', 'k2store')) {
         $this->setBillingAddress($session->get('billing_country_id', '', 'k2store'), $session->get('billing_zone_id', '', 'k2store'));
     } elseif ($config->get('config_tax_default') == 'billing') {
         $this->setBillingAddress($storeAddress->country_id, $storeAddress->zone_id);
     }
     // intialize session data with store's country and zone ids
     //$session->set('k2store_address', null);
     //$this->intializeStoreAddress();
     $this->setStoreAddress($storeAddress->country_id, $storeAddress->zone_id);
 }
예제 #6
0
파일: default.php 프로젝트: A-Bush/pprod
# copyright Copyright (C) 2012 Weblogicxindia.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://k2store.org
# Technical Support:  Forum - http://k2store.org/forum/index.html
-------------------------------------------------------------------------*/
// no direct access
defined('_JEXEC') or die('Restricted access');
require_once JPATH_ADMINISTRATOR . '/components/com_k2store/library/k2item.php';
require_once JPATH_SITE . '/components/com_k2store/helpers/cart.php';
require_once JPATH_ADMINISTRATOR . '/components/com_k2store/library/inventory.php';
$items = $this->cartobj;
//$mysubtotal = K2StoreHelperCart::getSubtotal();
//$state = $this->state;
$quantities = array();
$action = JRoute::_('index.php');
$storeAddress = K2StoreHelperCart::getStoreAddress();
if (isset($storeAddress->config_default_category) && $storeAddress->config_default_category != 0) {
    require_once JPATH_SITE . '/components/com_k2/helpers/route.php';
    $continue_shopping_url = JRoute::_(K2HelperRoute::getCategoryRoute($storeAddress->config_default_category));
}
if (isset($storeAddress->config_continue_shopping_url) && JString::strlen($storeAddress->config_continue_shopping_url) > 5) {
    $continue_shopping_url = $storeAddress->config_continue_shopping_url;
}
$checkout_url = JRoute::_('index.php?option=com_k2store&view=checkout');
?>
<div class="k2store">
<div class="row-fluid">
<div class="span12">
<?php 
if (!isset($this->remove)) {
    ?>
예제 #7
0
파일: checkout.php 프로젝트: A-Bush/pprod
 function shipping_payment_method()
 {
     $app = JFactory::getApplication();
     $view = $this->getView('checkout', 'html');
     $task = JRequest::getVar('task');
     $model = $this->getModel('checkout');
     $cart_helper = new K2StoreHelperCart();
     $cart_model = $this->getModel('mycart');
     if (!$cart_helper->hasProducts()) {
         $msg = JText::_('K2STORE_NO_ITEMS_IN_CART');
         $link = JRoute::_('index.php?option=com_k2store&view=mycart');
         $app->redirect($link, $msg);
     }
     //prepare order
     $order = $this->_order;
     $order = $this->populateOrder(false);
     // get the order totals
     $order->calculateTotals();
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('k2store');
     //custom fields
     $selectableBase = new K2StoreSelectableBase();
     $view->assign('fieldsClass', $selectableBase);
     $address_table = JTable::getInstance('address', 'Table');
     $fields = $selectableBase->getFields('payment', $address, 'address');
     $view->assign('fields', $fields);
     $view->assign('address', $address_table);
     //get layout settings
     $view->assign('storeProfile', K2StoreHelperCart::getStoreAddress());
     $showShipping = false;
     if ($this->params->get('show_shipping_address', 0)) {
         $showShipping = true;
     }
     if ($isShippingEnabled = $cart_model->getShippingIsEnabled()) {
         $showShipping = true;
         //$this->setShippingMethod();
     }
     $view->assign('showShipping', $showShipping);
     if ($showShipping) {
         $rates = $this->getShippingRates();
         $shipping_layout = "shipping_yes";
         //	if (!$this->session->has('shipping_address_id', 'k2store'))
         //	{
         //		$shipping_layout = "shipping_calculate";
         //	}
         $shipping_method_form = $this->getShippingHtml($shipping_layout);
         $view->assign('showShipping', $showShipping);
         $view->assign('shipping_method_form', $shipping_method_form);
         $view->assign('rates', $rates);
     }
     //process payment plugins
     $showPayment = true;
     if ((double) $order->order_total == (double) '0.00') {
         $showPayment = false;
     }
     $view->assign('showPayment', $showPayment);
     require_once JPATH_SITE . '/components/com_k2store/helpers/plugin.php';
     $payment_plugins = K2StoreHelperPlugin::getPluginsWithEvent('onK2StoreGetPaymentPlugins');
     $plugins = array();
     if ($payment_plugins) {
         foreach ($payment_plugins as $plugin) {
             $results = $dispatcher->trigger("onK2StoreGetPaymentOptions", array($plugin->element, $order));
             if (in_array(true, $results, true)) {
                 $plugins[] = $plugin;
             }
         }
     }
     if (count($plugins) == 1) {
         $plugins[0]->checked = true;
         //	ob_start();
         $html = $this->getPaymentForm($plugins[0]->element, true);
         //	$html = json_decode( ob_get_contents() );
         //	ob_end_clean();
         $view->assign('payment_form_div', $html);
     }
     $view->assign('plugins', $plugins);
     //also set the payment methods to session
     //terms and conditions
     if ($this->params->get('termsid')) {
         $tos_link = JRoute::_('index.php?option=com_k2&view=item&tmpl=component&id=' . $this->params->get('termsid'));
     } else {
         $tos_link = null;
     }
     $view->assign('tos_link', $tos_link);
     //Get and Set Model
     $view->setModel($model, true);
     $view->assign('order', $order);
     $view->assign('params', $this->params);
     $view->setLayout('checkout_shipping_payment');
     ob_start();
     $view->display();
     $html = ob_get_contents();
     ob_end_clean();
     echo $html;
     $app->close();
 }
예제 #8
0
파일: orders.php 프로젝트: A-Bush/pprod
 function createInvoiceNumber($order_id)
 {
     $db = JFactory::getDbo();
     $status = true;
     $invoice = new JObject();
     $invoice->number = 0;
     $invoice->prefix = '';
     require_once JPATH_SITE . '/components/com_k2store/helpers/cart.php';
     $store = K2StoreHelperCart::getStoreAddress();
     if (!isset($store->store_invoice_prefix) || empty($store->store_invoice_prefix)) {
         //backward compatibility. If no prefix is set, retain the invoice number is the table primary key.
         $status = false;
     }
     if ($status) {
         //get the last row
         $query = $db->getQuery(true)->select('MAX(invoice_number) AS invoice_number')->from('#__k2store_orders')->where('invoice_prefix=' . $db->q($store->store_invoice_prefix));
         $db->setQuery($query);
         $row = $db->loadObject();
         if (isset($row->invoice_number) && $row->invoice_number) {
             $invoice_number = $row->invoice_number + 1;
         } else {
             $invoice_number = 1;
         }
         $invoice->number = $invoice_number;
         $invoice->prefix = $store->store_invoice_prefix;
     }
     return $invoice;
 }
예제 #9
0
파일: currencies.php 프로젝트: A-Bush/pprod
 public function updateCurrencies($force = false)
 {
     if (extension_loaded('curl')) {
         $data = array();
         require_once JPATH_SITE . '/components/com_k2store/helpers/cart.php';
         $storeprofile = K2StoreHelperCart::getStoreAddress();
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('*')->from('#__k2store_currency')->where('currency_code !=' . $db->q($storeprofile->config_currency));
         if ($force) {
             $query->where('currency_modified=' . $db->q(date('Y-m-d H:i:s', strtotime('-1 day'))));
         }
         $db->setQuery($query);
         $rows = $db->loadAssocList();
         foreach ($rows as $result) {
             $data[] = $storeprofile->config_currency . $result['currency_code'] . '=X';
         }
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, 'http://download.finance.yahoo.com/d/quotes.csv?s=' . implode(',', $data) . '&f=sl1&e=.csv');
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         $content = curl_exec($curl);
         curl_close($curl);
         $lines = explode("\n", trim($content));
         foreach ($lines as $line) {
             $currency = utf8_substr($line, 4, 3);
             $value = utf8_substr($line, 11, 6);
             if ((double) $value) {
                 $query = $db->getQuery(true);
                 $query->update('#__k2store_currency')->set('currency_value =' . $db->q((double) $value))->set('currency_modified=' . $db->q(date('Y-m-d H:i:s')))->where('currency_code=' . $db->q($currency));
                 $db->setQuery($query);
                 $db->query();
             }
         }
         //update the default currency
         $query = $db->getQuery(true);
         $query->update('#__k2store_currency')->set('currency_value =' . $db->q('1.00000'))->set('currency_modified=' . $db->q(date('Y-m-d H:i:s')))->where('currency_code=' . $db->q($storeprofile->config_currency));
         $db->setQuery($query);
         $db->query();
     }
 }
예제 #10
0
파일: inventory.php 프로젝트: A-Bush/pprod
 public static function getStock($product_id)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('*');
     $query->from('#__k2store_products');
     $query->where('product_id=' . $db->quote($product_id));
     $db->setQuery($query);
     $stock = $db->loadObject();
     if (!isset($stock) || K2STORE_PRO != 1) {
         $stock = JTable::getInstance('Products', 'Table');
     }
     //prepare data. We may have some settings in the store global
     require_once JPATH_SITE . '/components/com_k2store/helpers/cart.php';
     $store_config = K2StoreHelperCart::getStoreAddress();
     if ($stock->use_store_config_min_out_qty > 0) {
         $stock->min_out_qty = (double) $store_config->store_min_out_qty;
     }
     if ($stock->use_store_config_min_sale_qty > 0) {
         $stock->min_sale_qty = (double) $store_config->store_min_sale_qty;
     }
     if ($stock->use_store_config_max_sale_qty > 0) {
         $stock->max_sale_qty = (double) $store_config->store_max_sale_qty;
     }
     if ($stock->use_store_config_notify_qty > 0) {
         $stock->notify_qty = (double) $store_config->store_notify_qty;
     }
     return $stock;
 }
예제 #11
0
파일: mycart.php 프로젝트: A-Bush/pprod
 function display($cachable = false, $urlparams = array())
 {
     //initialist system objects
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     K2StoreUtilities::cleanCache();
     $params = JComponentHelper::getParams('com_k2store');
     $view = $this->getView('mycart', 'html');
     $view->set('_view', 'mycart');
     //get post vars
     $post = $app->input->getArray($_POST);
     $model = $this->getModel('Mycart');
     $checkout_model = $this->getModel('checkout');
     $store = K2StoreHelperCart::getStoreAddress();
     if (K2StoreHelperCart::hasProducts()) {
         $items = $model->getDataNew();
     } else {
         $items = array();
     }
     //coupon
     $post_coupon = $app->input->getString('coupon', '');
     //first time applying? then set coupon to session
     if (isset($post_coupon) && !empty($post_coupon)) {
         try {
             if ($this->validateCoupon()) {
                 $session->set('coupon', $post_coupon, 'k2store');
                 $msg = JText::_('K2STORE_COUPON_APPLIED_SUCCESSFULLY');
             }
         } catch (Exception $e) {
             $msg = $e->getMessage();
         }
         $this->setRedirect(JRoute::_("index.php?option=com_k2store&view=mycart"), $msg);
     }
     if ($post_coupon) {
         $view->assign('coupon', $post_coupon);
     } elseif ($session->has('coupon', 'k2store')) {
         $view->assign('coupon', $session->get('coupon', '', 'k2store'));
     } else {
         $view->assign('coupon', '');
     }
     //shipping tax calculator
     //get countries
     $db = JFactory::getDbo();
     $db->setQuery($db->getQuery(true)->select('country_id, country_name')->from('#__k2store_countries')->where('state=1'));
     $countries = $db->loadObjectList();
     $country_id = $app->input->getInt('country_id');
     if (isset($country_id)) {
         $session->set('billing_country_id', $country_id, 'k2store');
         $session->set('shipping_country_id', $country_id, 'k2store');
     } elseif ($session->has('shipping_country_id', 'k2store')) {
         $country_id = $session->get('shipping_country_id', '', 'k2store');
     } else {
         $country_id = $store->country_id;
     }
     $countryList = JHtml::_('select.genericlist', $countries, 'country_id', $attribs = null, $optKey = 'country_id', $optText = 'country_name', $country_id, $idtag = 'cart_country', $translate = false);
     $zone_id = $app->input->getInt('zone_id');
     if (isset($zone_id)) {
         $session->set('billing_zone_id', $zone_id, 'k2store');
         $session->set('shipping_zone_id', $zone_id, 'k2store');
     } elseif ($session->has('shipping_zone_id', 'k2store')) {
         $zone_id = $session->get('shipping_zone_id', '', 'k2store');
     } else {
         $zone_id = $store->zone_id;
     }
     $postcode = $app->input->getString('postcode');
     if (isset($postcode)) {
         $session->set('shipping_postcode', $postcode, 'k2store');
     } elseif ($session->has('shipping_postcode', 'k2store')) {
         $postcode = $session->get('shipping_postcode', '', 'k2store');
     } else {
         $postcode = $store->store_zip;
     }
     $view->assign('countryList', $countryList);
     $view->assign('country_id', $country_id);
     $view->assign('zone_id', $zone_id);
     $view->assign('postcode', $postcode);
     //assign a single selected method if it had been selected
     if ($session->has('shipping_values', 'k2store')) {
         //get exisitng values
         $shipping_values = $session->get('shipping_values', array(), 'k2store');
         $rates = $checkout_model->getShippingRates();
         $session->set('shipping_methods', $rates, 'k2store');
         if (count($rates) < 1) {
             $session->set('shipping_method', array(), 'k2store');
         }
         $is_same = false;
         foreach ($rates as $rate) {
             if ($shipping_values['shipping_name'] == $rate['name']) {
                 $shipping_values['shipping_price'] = isset($rate['price']) ? $rate['price'] : 0;
                 $shipping_values['shipping_extra'] = isset($rate['extra']) ? $rate['extra'] : 0;
                 $shipping_values['shipping_code'] = isset($rate['code']) ? $rate['code'] : '';
                 $shipping_values['shipping_name'] = isset($rate['name']) ? $rate['name'] : '';
                 $shipping_values['shipping_tax'] = isset($rate['tax']) ? $rate['tax'] : 0;
                 $shipping_values['shipping_plugin'] = isset($rate['element']) ? $rate['element'] : '';
                 $session->set('shipping_method', $shipping_values['shipping_plugin'], 'k2store');
                 $session->set('shipping_values', $shipping_values, 'k2store');
                 $is_same = true;
             }
         }
         if ($is_same === false) {
             //sometimes the previously selected method may not apply. In those cases, we will have remove the selected shipping.
             $session->set('shipping_values', array(), 'k2store');
         }
         $view->assign('shipping_values', $session->get('shipping_values', array(), 'k2store'));
     } else {
         $view->assign('shipping_values', array());
     }
     //do we have shipping methods
     if ($session->has('shipping_methods', 'k2store')) {
         $view->assign('shipping_methods', $session->get('shipping_methods', array(), 'k2store'));
     }
     //assign a single selected method if it had been selected
     if ($session->has('shipping_method', 'k2store')) {
         $view->assign('shipping_method', $session->get('shipping_method', array(), 'k2store'));
     } else {
         $view->assign('shipping_method', array());
     }
     $cartobject = $model->checkItems($items, $params->get('show_tax_total'));
     $totals = $model->getTotals();
     JPluginHelper::importPlugin('k2store');
     $results = $app->triggerEvent('onK2StoreAfterDisplayCart', array($items));
     $view->assign('onK2StoreAfterDisplayCart', trim(implode("\n", $results)));
     $view->assign('cartobj', $cartobject);
     $view->assign('totals', $totals);
     $view->assign('model', $model);
     $view->assign('params', $params);
     if (isset($post['return'])) {
         $view->assign('return', $post['return']);
     }
     $view->set('_doTask', true);
     $view->set('hidemenu', true);
     $view->setModel($model, true);
     $view->setLayout('default');
     $view->display();
 }
예제 #12
0
파일: base.php 프로젝트: A-Bush/pprod
 function display($field, $value, $map, $inside, $options = '', $test = false, $allFields = null, $allValues = null)
 {
     $app = JFactory::getApplication();
     require_once JPATH_SITE . '/components/com_k2store/helpers/cart.php';
     $store = K2StoreHelperCart::getStoreAddress();
     $stateId = $currentZoneId = $store->zone_id > 0 ? $store->zone_id : '';
     $country_id = $store->country_id > 0 ? $store->country_id : '';
     //if no default value was set in the fields, then use the country id set in the store profile.
     if (empty($field->field_default)) {
         $defaultCountry = $country_id;
     }
     if (empty($value)) {
         $value = $field->field_default;
     }
     if ($field->field_options['zone_type'] == 'country') {
         if (isset($defaultCountry)) {
             $field->field_default = $defaultCountry;
         }
     } elseif ($field->field_options['zone_type'] == 'zone') {
         $stateId = str_replace(array('[', ']'), array('_', ''), $map);
         $dropdown = '';
         if ($allFields != null) {
             $country = null;
             foreach ($allFields as $f) {
                 if ($f->field_type == 'zone' && !empty($f->field_options['zone_type']) && $f->field_options['zone_type'] == 'country') {
                     $key = $f->field_namekey;
                     if (!empty($allValues->{$key})) {
                         $country = $allValues->{$key};
                     } else {
                         $country = $f->field_default;
                     }
                     break;
                 }
             }
             //no country id, then load it based on the zone default.
             if (empty($country) && isset($field->field_default)) {
                 JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_k2store/tables');
                 $table = JTable::getInstance('zone', 'Table');
                 if ($table->load($field->field_default)) {
                     $country = $table->country_id;
                 }
             }
             //still no. Set it to store default.
             if (empty($country)) {
                 $country = $store->country_id;
             }
             if (!empty($country)) {
                 $countryType = new k2storeCountryType();
                 $countryType->type = 'zone';
                 $countryType->country_id = $country;
                 $countryType->published = true;
                 $dropdown = $countryType->displayZone($map, $value, true);
             }
         }
         $html = '<span id="' . $stateId . '_container">' . $dropdown . '</span>' . '<input type="hidden" id="' . $stateId . '_default_value" name="' . $stateId . '_default_value" value="' . $value . '"/>';
         return $html;
     }
     return parent::display($field, $value, $map, $inside, $options, $test, $allFields, $allValues);
 }
예제 #13
0
파일: cart.php 프로젝트: A-Bush/pprod
 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];
 }