function StoreAllAttribute($item_id, $allAttrib, $sku, $client) { // get attributeid list FROM POST $attIdList = array(); foreach ($allAttrib as $attributes) { if (!empty($attributes['attri_id'])) { $attIdList[] = $attributes['attri_id']; } } // DEL EXTRA ATTRIBUTES if (!class_exists('productHelper')) { // require while called from backend JLoader::register('productHelper', JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helpers' . DS . 'product.php'); JLoader::load('productHelper'); } //THIS DELETE db attributes which is not present now or removed $productHelper = new productHelper(); $productHelper->deleteExtaAttribute($item_id, $attIdList); if (!class_exists('quick2cartModelAttributes')) { // require while called from backend JLoader::register('quick2cartModelAttributes', JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models' . DS . 'attributes.php'); JLoader::load('quick2cartModelAttributes'); } $quick2cartModelAttributes = new quick2cartModelAttributes(); foreach ($allAttrib as $key => $attr) { $attr['sku'] = $sku; $attr['client'] = $client; $attr['item_id'] = $item_id; // Dont consider empty attributes if (!empty($attr['attri_name'])) { $quick2cartModelAttributes->store($attr); } } }
"> </td> <td> <?php $addpre_val = isset($this->attribute_opt[$k]->itemattributeoption_prefix) ? $this->attribute_opt[$k]->itemattributeoption_prefix : ''; echo JHtml::_('select.genericlist', $addpre_select, "att_detail[attri_opt][{$k}][prefix]", 'class="span1" size="1" ', "value", "text", $addpre_val); ?> </td> <td> <?php $currencies = $params->get('addcurrency'); $curr = explode(',', $currencies); ?> <div class='qtc_currencey_textbox input-append control-group' > <?php $quick2cartModelAttributes = new quick2cartModelAttributes(); foreach ($curr as $value) { $currvalue = array(); $storevalue = ""; if (isset($this->attribute_opt[$k])) { $currvalue = $quick2cartModelAttributes->getOption_currencyValue($this->attribute_opt[$k]->itemattributeoption_id, $value); $storevalue = isset($currvalue[0]['price']) ? $currvalue[0]['price'] : ''; } ?> <div class="input-append curr_margin " > <input type='text' name="att_detail[attri_opt][<?php echo $k; ?> ][currency][<?php echo $value; ?>
JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.modal', 'a.modal'); /*list of attributes of item*/ $params = JComponentHelper::getParams('com_quick2cart'); $qtc_base_url = JUri::root(); $lang = JFactory::getLanguage(); $lang->load('com_quick2cart', JPATH_SITE); $document = JFactory::getDocument(); $addpre_select[] = JHtml::_('select.option', '+', JText::_('QTC_ADDATTRI_PREADD')); $addpre_select[] = JHtml::_('select.option', '-', JText::_('QTC_ADDATTRI_PRESUB')); //$addpre_select[] = JHtml::_('select.option','=', JText::_('QTC_ADDATTRI_PRESAM')); $del_link = $qtc_base_url . 'index.php?option=com_quick2cart&task=attributes.delattribute'; if (!empty($pid) && $client) { // declaration section $quick2cartModelAttributes = new quick2cartModelAttributes(); $path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helpers' . DS . 'product.php'; if (!class_exists('productHelper')) { //require_once $path; JLoader::register('productHelper', $path); JLoader::load('productHelper'); } $productHelper = new productHelper(); if (empty($item_id)) { } else { $attributes = $quick2cartModelAttributes->getItemAttributes($item_id); $getMediaDetail = $productHelper->getMediaDetail($item_id); $addMediaLink = $qtc_base_url . 'index.php?option=com_quick2cart&view=attributes&layout=media&tmpl=component&item_id=' . $item_id; } ?> <script type="text/javascript">
if (!class_exists('qtcshiphelper')) { //require_once $path; $path = JPATH_SITE . '/components/com_quick2cart/helpers/qtcshiphelper.php'; JLoader::register('qtcshiphelper', $path); JLoader::load('qtcshiphelper'); } $qtcshiphelper = new qtcshiphelper(); $params = JComponentHelper::getParams('com_quick2cart'); $qtc_shipping_opt_status = $params->get('shipping', 0); $isTaxationEnabled = $params->get('enableTaxtion', 0); $prodAdmin_approval = $params->get('admin_approval', 0); $document = JFactory::getDocument(); $qtc_base_url = JUri::root(); $js_currency = "\n\tvar qtc_base_url=\"" . $qtc_base_url . "\"\n\ttechjoomla.jQuery(document).ready(function()\n\t{\n\n\t var width = techjoomla.jQuery(window).width();\n\n\t if (width < 321 )\n\t {\n\t\t\ttechjoomla.jQuery('div.techjoomla-bootstrap').removeClass('form-horizontal');\n\t\t\ttechjoomla.jQuery('div.q2c-wrapper').removeClass('form-horizontal');\n\t\t}\n\t});\n\n\tfunction checkfornum(el)\n\t{\n\t\tvar i =0 ;\n\t\tfor(i=0;i<el.value.length;i++)\n\t\t{\n\t\t if (el.value.charCodeAt(i) > 47 && el.value.charCodeAt(i) < 58) { alert('Numerics Not Allowed'); el.value = el.value.substring(0,i); break;}\n\t\t}\n\t}\n"; JLoader::import('attributes', JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models'); $quick2cartModelAttributes = new quick2cartModelAttributes(); $change_storeto = 0; if (!empty($pid)) { $this->itemDetail = $itemDetail = $quick2cartModelAttributes->getItemDetail($pid, $client); // Get store id of product $change_storeto = $this->itemDetail['store_id']; // Get owner of store $storeInfo = $this->comquick2cartHelper->getSoreInfo($change_storeto); $owner = $storeInfo['owner']; $itemvalue = $itemDetail['name']; } $currencies = $params->get('addcurrency'); $curr = explode(',', $currencies); JLoader::import('store', JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models'); $store_model = new Quick2cartModelstore(); $owner = isset($owner) ? $owner : 0;
function EditMediFile() { // Add Language file. $lang = JFactory::getLanguage(); $lang->load('com_quick2cart', JPATH_ADMINISTRATOR); $qtc_base_url = JUri::root(); // get Product_id via ajax url. $jinput = JFactory::getApplication()->input; $item_id = $jinput->get('pid'); // Get file id for delete. $file_id = $jinput->get('file_id'); $path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models' . DS . 'attributes.php'; if (!class_exists('attributes')) { // require_once $path; JLoader::register('attributes', $path); JLoader::load('attributes'); } $quick2cartModelAttributes = new quick2cartModelAttributes(); $path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helpers' . DS . 'product.php'; if (!class_exists('productHelper')) { // require_once $path; JLoader::register('productHelper', $path); JLoader::load('productHelper'); } $productHelper = new productHelper(); $delFiles = array(); $delFiles[] = $file_id; $attributes = $quick2cartModelAttributes->getItemAttributes($item_id); $getMediaDetail = $productHelper->getMediaDetail($item_id, $file_id); $addMediaLink = $qtc_base_url . 'index.php?option=com_quick2cart&view=attributes&layout=media&tmpl=component&item_id=' . $item_id; $html = ''; $count = $jinput->get('count'); $count = $count - 1; if (!empty($getMediaDetail)) { for ($i = 0; $i < count($getMediaDetail); $i++) { if ($i > $count) { $html .= '<tr class="' . "file_" . $getMediaDetail[$i]['file_id'] . '"> <td>' . $getMediaDetail[$i]['file_display_name'] . '</td> <td>'; $mediaClass = ' badge'; $purchaseStatus = JText::_('QTC_ADDATTRI_PURCHASE_REQ_NO'); if (!empty($getMediaDetail[$i]['purchase_required'])) { $mediaClass = ' badge badge-success'; $purchaseStatus = JText::_('QTC_ADDATTRI_PURCHASE_REQ_YES'); } $html .= '<span class="' . $mediaClass . '">' . $purchaseStatus . '</span> </td>'; $edit_link = $addMediaLink . '&file_id=' . $getMediaDetail[$i]['file_id'] . '&edit=1'; $del_link = $addMediaLink . '&file_id=' . $getMediaDetail[$i]['file_id']; $html .= '<td> <a rel="{handler: \'iframe\', size: {x: 800, y: 550}, onClose: function(){EditFile(' . $getMediaDetail[$i]['file_id'] . ',' . $item_id . ');}}" class="btn btn-mini btn-primary modal qtc_modal" href="' . $edit_link . '"> <i class="icon-pencil-2 icon-white"></i> </a> <button type="button" class="btn btn-mini btn-danger " onclick="deleteMediFile(' . $getMediaDetail[$i]['file_id'] . ',' . $item_id . ' )"><i class="icon-trash icon-white"></i></button> </td> </tr>'; } } $data['html'] = $html; echo json_encode($html); } jexit(); }
function getCurrenciesvalue($pid, $curr, $client, $item_id = '') { if (empty($item_id)) { $quick2cartModelAttributes = new quick2cartModelAttributes(); $item_id = $quick2cartModelAttributes->getitemid($pid, $client); } $db = JFactory::getDBO(); $query = "SELECT * FROM #__kart_base_currency WHERE item_id = " . (int) $item_id . " AND currency='" . $curr . "'"; $db->setQuery($query); $result = $db->loadAssocList(); return $result; }
function getProdPriceWithDefltAttributePrice($item_id) { $return = array(); $return['itemdetail'] = array(); $helperobj = new comquick2cartHelper(); $curr = $helperobj->getCurrencySession(); $path = JPATH_SITE . DS . 'components/com_quick2cart/models/attributes.php'; if (!class_exists('quick2cartModelAttributes')) { JLoader::register('quick2cartModelAttributes', $path); JLoader::load('quick2cartModelAttributes'); } $quick2cartModelAttributes = new quick2cartModelAttributes(); // GETTING ITEM_DETAILS $item_details = $quick2cartModelAttributes->getCurrenciesvalue('0', $curr, 'com_quick2cart', $item_id); if (!empty($item_details[0])) { $return['itemdetail'] = $item_details[0]; } // GETTING ATTRIBUTE DETAILS $attribure_option_ids = array(); $tot_att_price = 0; $allAttr = $quick2cartModelAttributes->getItemAttributes($item_id); if (!empty($allAttr)) { foreach ($allAttr as $attr) { // if cumpulsory then only consider price ( i.e attribute_compulsary=0) if (!empty($attr->attribute_compulsary)) { $attr_details = $helperobj->getAttributeDetails($attr->itemattribute_id); foreach ($attr_details as $options) { if ($options->ordering == 1 && !empty($options->{$curr})) { $attribure_option_ids[] = $options->itemattributeoption_id; $tot_att_price += $options->{$curr}; break; } // consider prefix also } } } } $attrDetails = array(); $attrDetails['tot_att_price'] = $tot_att_price; $attrDetails['attrOptionIds'] = $attribure_option_ids; $return['attrDetail'] = $attrDetails; return $return; }