function SendMailToAdminApproval($prod_values, $item_id, $newProduct = 1) { $loguser = JFactory::getUser(); $comquick2cartHelper = new comquick2cartHelper(); $app = JFactory::getApplication(); $mailfrom = $app->getCfg('mailfrom'); $fromname = $app->getCfg('fromname'); $sitename = $app->getCfg('sitename'); $params = JComponentHelper::getParams('com_quick2cart'); $sendto = $params->get('sale_mail'); $currency = $comquick2cartHelper->getCurrencySession(); //$params->get('addcurrency'); // @sheha : currency should take from session instead of param //$sendto = $mailfrom; $multiple_img = array(); $count = 0; $prod_imgs = $prod_values->get('qtc_prodImg', array(), "ARRAY"); $quick2cartModelProduct = new quick2cartModelProduct(); $multiple_img = $quick2cartModelProduct->getProdutImages($item_id); $body = ''; // Edit product if ($newProduct == 0) { $subject = JText::_('COM_Q2C_EDIT_PRODUCT_SUBJECT'); $subject = str_replace('{sellername}', $loguser->name, $subject); $body = JText::_('COM_Q2C_EDIT_PRODUCT_BODY'); $body = str_replace('{productname}', $prod_values->get('item_name', '', 'RAW'), $body); $pod_price = $prod_values->get('multi_cur', array(), "ARRAY"); $body = str_replace('{price}', $pod_price[$currency], $body); $body = str_replace('{sellername}', $loguser->name, $body); $body = str_replace('{sku}', $prod_values->get('sku', '', 'RAW'), $body); //~ for($i=0; $i < count($multiple_img); $i++) //~ { //~ print"<pre>"; print_r($multiple_img); die("222882"); //~ $body .= '<br><img src="' . JUri::root() . 'images/quick2cart/' . $multiple_img[$i] . '" alt="No image" ><br>'; //~ } if (!empty($multiple_img)) { $multiple_img = (array) $multiple_img; foreach ($multiple_img as $key => $img) { $body .= '<br><img src="' . JUri::root() . 'images/quick2cart/' . $img[$key] . '" alt="No image" ><br>'; } } } else { $subject = JText::_('COM_Q2C_PRODUCT_AAPROVAL_SUBJECT'); $body = JText::_('COM_Q2C_PRODUCT_AAPROVAL_BODY'); $body = str_replace('{title}', $prod_values->get('item_name', '', 'RAW'), $body); $body = str_replace('{sellername}', $loguser->name, $body); $desc = $prod_values->get('description', '', 'ARRAY'); $desc = strip_tags(trim($desc['data'])); $body = str_replace('{des}', $desc, $body); $body = str_replace('{link}', JUri::base() . 'administrator/index.php?option=com_quick2cart&view=products&filter_published=0', $body); for ($i = 0; $i < count($multiple_img); $i++) { $body .= '<br><img src="' . JUri::ROOT() . 'images/quick2cart/' . $multiple_img[$i] . '" alt="No image" ><br>'; } } $res = $comquick2cartHelper->sendmail($mailfrom, $subject, $body, $sendto); }
function getTotalOrdersCount($storeid) { $db = JFactory::getDBO(); //getting current currency $comquick2cartHelper = new comquick2cartHelper(); $currency = $comquick2cartHelper->getCurrencySession(); $query = "SELECT COUNT( DISTINCT (o.`id`) )\n\t\t\t\t\t\t\tFROM `#__kart_order_item` AS i, #__kart_orders AS o\n\t\t\t\t\t\t\tWHERE i.store_id =" . $storeid . "\n\t\t\t\t\t\t\tAND i.`order_id` = o.id\n\t\t\t\t\t\t\tAND (o.status = 'C' OR o.status = 'S' )\n\t\t\t\t\t\t\tAND o.currency = '" . $currency . "'\n\t\t\t\t\t\t\tAND i.`order_id` = o.id "; $db->setQuery($query); return $db->loadResult(); }
} }); } </script> <div class="qyc_admin_zones <?php echo Q2C_WRAPPER_CLASS; ?> "> <?php // Add store toolbar $helperobj = new comquick2cartHelper(); $active = 'zones'; $order_currency = $helperobj->getCurrencySession(); $view = $helperobj->getViewpath('vendor', 'toolbar'); ob_start(); include $view; $html = ob_get_contents(); ob_end_clean(); echo $html; ?> <div class="row-fluid"> <div class="form-horizontal"> <form action="<?php echo JRoute::_('index.php?option=com_quick2cart&layout=edit&id=' . (int) $this->item->id); ?> " method="post" enctype="multipart/form-data" name="zoneForm" id="zoneForm" class="form-validate"> <fieldset class="adminform"> <legend>
function getAttrOptionPrice($attop_id) { if ($attop_id) { $db = JFactory::getDBO(); $comquick2cartHelper = new comquick2cartHelper(); $currency = $comquick2cartHelper->getCurrencySession(); $query = "SELECT price FROM `#__kart_option_currency` WHERE itemattributeoption_id= " . (int) $attop_id . " AND currency='{$currency}'"; $db->setQuery($query); $result = $db->loadResult(); return $result; } }
function saveStore($data) { $comparams = JComponentHelper::getParams('com_quick2cart'); $row = new stdClass(); $row->owner = $data['owner']; $row->title = $data['title']; $row->description = $data['description']; $row->address = $data['address']; $row->phone = $data['phone']; $row->store_email = $data['store_email']; $row->store_avatar = $data['store_avatar']; //@TODO get the uploaded image path $comquick2cartHelper = new comquick2cartHelper(); $row->currency_name = isset($data['currency_name']) ? $data['currency_name'] : $comquick2cartHelper->getCurrencySession(); $row->use_ship = isset($data['use_ship']) ? $data['use_ship'] : $comparams->get('shipping'); $row->use_stock = isset($data['use_stock']) ? $data['use_stock'] : $comparams->get('usestock'); $row->ship_no_stock = isset($data['ship_no_stock']) ? $data['ship_no_stock'] : $comparams->get('outofstock_allowship'); $row->buy_button_text = isset($data['buy_button_text']) ? $data['buy_button_text'] : JText::_('QTC_ITEM_BUY'); if (isset($data['live'])) { $row->live = $data['live']; } if (isset($data['extra'])) { $row->extra = $data['extra']; } $query = "Select id FROM #__kart_store WHERE owner=" . $data['owner']; $this->_db->setQuery($query); $store = $this->_db->loadResult(); if ($store) { $row->id = $store; if (!$this->_db->updateObject('#__kart_store', $row, 'id')) { echo $this->_db->stderr(); return false; } } else { if (!$this->_db->insertObject('#__kart_store', $row, 'id')) { echo $this->_db->stderr(); return false; } } return true; }
/** *Function used to set currency session * * @param STRING $cur Currency * * @return json * * @since 1.0.0 */ public function setCurrencySession($cur = null) { $jinput = JFactory::getApplication()->input; if ($cur == null || !$curr) { $curr = $jinput->get('currency'); } $comquick2cartHelper = new comquick2cartHelper(); $oldcurrency = $comquick2cartHelper->getCurrencySession(); $model = $this->getModel('cart'); $return = $model->syncCartCurrency($oldcurrency, $curr); /*if($return==true) // synchronise with new currency setcookie('qtc_currency',$curr,time() + (86400 * 7)); // 86400 = 1 day */ echo $return; jexit(); }
/** * This function check whether all option has price respect to curreny * * @param MIXED $itemDetail itemDetail * * @return boolean */ public function hasAttributePrice($itemDetail) { $comquick2cartHelper = new comquick2cartHelper(); $currency = $comquick2cartHelper->getCurrencySession(); foreach ($itemDetail as $attributs) { foreach ($attributs->optionDetails as $option) { // Does have currency price for attribute if (!property_exists($option, $currency)) { return false; } } } return true; }
public function getPrefix($attoptionIds) { $comquick2cartHelper = new comquick2cartHelper(); $currency = $comquick2cartHelper->getCurrencySession(); //getFromattedPrice($price,$curr=NULL) $prefixarray = array(); $db = JFactory::getDBO(); foreach ($attoptionIds as $key => $attid) { $query = "Select i.`itemattributeoption_prefix` as prefix,op.`price` FROM `#__kart_itemattributeoptions` as i\n\t\t\t\t\t\tLEFT JOIN `#__kart_option_currency` AS op\n\t\t\t\t\t\t ON i.`itemattributeoption_id`=op.`itemattributeoption_id`\n\t\t\t\t\t\tWHERE i.`itemattributeoption_id`=" . $attid . " AND op.`currency`='" . $currency . "'"; $db->setQuery($query); $option_detail = $db->loadObject(); if (empty($option_detail)) { $option_detail = new stdClass(); $option_detail->price = 0; $option_detail->prefix = '+'; } $price = $comquick2cartHelper->getFromattedPrice($option_detail->price); $prefixarray[$key] = $option_detail->prefix . " " . $price; } return $prefixarray; }
/** * Function for pie chart * * @return array Get data for pie chart * * @since 2.2 */ public function statsforpie() { $db = JFactory::getDBO(); $session = JFactory::getSession(); // Getting current currency $comquick2cartHelper = new comquick2cartHelper(); $currency = $comquick2cartHelper->getCurrencySession(); $qtc_graph_from_date = $session->get('qtc_graph_from_date'); $socialads_end_date = $session->get('socialads_end_date'); $where = "AND currency='" . $currency . "'"; $groupby = ''; if ($qtc_graph_from_date) { // For graph $where .= " AND DATE(mdate) BETWEEN DATE('" . $qtc_graph_from_date . "') AND DATE('" . $socialads_end_date . "')"; } else { $day = date('d'); $month = date('m'); $year = date('Y'); $statsforpie = array(); $backdate = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' - 30 days')); $groupby = ""; } // Pending order $query = " SELECT COUNT(id) AS orders FROM #__kart_orders WHERE status= 'P'\n\t\tAND (processor NOT IN('payment_jomsocialpoints','payment_alphapoints') OR extra='points') " . $where; $db->setQuery($query); $statsforpie[] = $db->loadObjectList(); // Confirmed order $query = " SELECT COUNT(id) AS orders FROM #__kart_orders WHERE status= 'C'\n\t\tAND (processor NOT IN('payment_jomsocialpoints','payment_alphapoints') OR extra='points') " . $where; $db->setQuery($query); $statsforpie[] = $db->loadObjectList(); // Rejected order $query = " SELECT COUNT(id) AS orders FROM #__kart_orders WHERE status= 'RF'\n\t\tAND (processor NOT IN('payment_jomsocialpoints','payment_alphapoints') OR extra='points') " . $where; $db->setQuery($query); $statsforpie[] = $db->loadObjectList(); // Shipped order $query = " SELECT COUNT(id) AS orders FROM #__kart_orders WHERE status= 'S'\n\t\tAND (processor NOT IN('payment_jomsocialpoints','payment_alphapoints') OR extra='points') " . $where; $db->setQuery($query); $statsforpie[] = $db->loadObjectList(); return $statsforpie; }
{ techjoomla.jQuery('#qtc_item_id'+key).removeClass('qtc_icon-minus').addClass('qtc_icon-plus'); } }); } </script> <div class="<?php echo Q2C_WRAPPER_CLASS . ' ' . $params->get('moduleclass_sfx'); ?> " > <?php if (isset($beforecartmodule)) { echo $beforecartmodule; } $default_currency = $comquick2cartHelper->getCurrencySession(); $comparams = JComponentHelper::getParams('com_quick2cart'); $currencies = $comparams->get('addcurrency'); $currencies_sym = $comparams->get('addcurrency_sym'); //"INR,USD,AUD"; //@TODO get this from the component params $multi_curr = $currencies; $option = array(); $currcount = 0; if ($multi_curr) { $multi_currs = explode(",", $multi_curr); $currcount = count($multi_currs); $currencies_syms = explode(",", $currencies_sym); foreach ($multi_currs as $key => $curr) { if (!empty($currencies_syms[$key])) { $currtext = $currencies_syms[$key];
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; }
/** * @version SVN: <svn_id> * @package Quick2cart * @author Techjoomla <*****@*****.**> * @copyright Copyright (c) 2009-2015 TechJoomla. All rights reserved. * @license GNU General Public License version 2 or later. */ // No direct access. defined('_JEXEC') or die; //JHtml::_('behavior.tooltip'); //JHtml::_('behavior.framework'); //JHtml::_('behavior.modal'); $lang = JFactory::getLanguage(); $lang->load('com_quick2cart', JPATH_SITE); $helperobj = new comquick2cartHelper(); $curr = $helperobj->getCurrencySession(); // Added by aniket $entered_numerics = "'" . JText::_('QTC_ENTER_NUMERICS') . "'"; $path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models' . DS . 'attributes.php'; if (!class_exists('quick2cartModelAttributes')) { JLoader::register('quick2cartModelAttributes', $path); JLoader::load('quick2cartModelAttributes'); } $quick2cartModelAttributes = new quick2cartModelAttributes(); $item_id = is_object($data) ? $data->item_id : $data['item_id']; $productHelper = new productHelper(); // Check whether product is allowd to buy or not. ( our of stock) $itemDetailObj = (object) $data; $qtcTeaserShowBuyNowBtn = $productHelper->isInStockProduct($itemDetailObj); $prodAttDetails = $productHelper->getProdPriceWithDefltAttributePrice($item_id); $it_price = $prodAttDetails;