Пример #1
0
    define('DS', '/');
}
if (JFile::exists(JPATH_SITE . '/components/com_quick2cart/quick2cart.php')) {
    $path = JPATH_SITE . '/components/com_quick2cart/helper.php';
    if (!class_exists('comquick2cartHelper')) {
        JLoader::register('comquick2cartHelper', $path);
        JLoader::load('comquick2cartHelper');
    }
    // Load assets
    comquick2cartHelper::loadQuicartAssetFiles();
    $doc = JFactory::getDocument();
    $lang = JFactory::getLanguage();
    $lang->load('mod_quick2cart', JPATH_SITE);
    JLoader::import('cart', JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models');
    $model = new Quick2cartModelcart();
    $cart = $model->getCartitems();
    // Trigger onBeforeCartModule
    $dispatcher = JDispatcher::getInstance();
    JPluginHelper::importPlugin('system');
    $result = $dispatcher->trigger('onBeforeCartModule');
    if (!empty($result)) {
        $beforecartmodule = $result[0];
    }
    // Trigger onAfterCartModule
    $dispatcher = JDispatcher::getInstance();
    JPluginHelper::importPlugin('system');
    $result = $dispatcher->trigger('onAfterCartModule');
    if (!empty($result)) {
        $aftercartdisplay = $result[0];
    }
    // Hide mod when cart is empty.
Пример #2
0
 /**
  * get_module
  *
  * @param   integer  $layout_type  layout_type
  * @param   string   $ckout_text   ckout_text
  *
  * @return  html.
  *
  * @since   1.6
  */
 public function get_module($layout_type = "", $ckout_text = '')
 {
     $comquick2cartHelper = new comquick2cartHelper();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $modulePara = $comquick2cartHelper->getModuleParams('mod_quick2cart');
         $moduleParams = json_decode($modulePara);
     } else {
         $module = JModuleHelper::getModule('mod_quick2cart');
         $moduleParams = json_decode($module->params);
     }
     /* params will be added in #__modules only on saving module param
      * so if module params are not found in #__modules then take default param from  #_extention */
     if (empty($moduleParams)) {
         $module = $comquick2cartHelper->getExtentionparam('mod_quick2cart');
         $moduleParams = json_decode($module);
     }
     if (empty($layout_type)) {
         $layout_type = $moduleParams->viewtype;
     }
     if (empty($ckout_text)) {
         $ckout_text = $moduleParams->checkout_text;
     }
     $model = new Quick2cartModelcart();
     $cart = $model->getCartitems();
     if ($layout_type == "detail") {
         $layout = 'default_itemrow';
     } else {
         $layout = 'default_itemshort';
     }
     // Call the plugin and get the result
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('system');
     $result = $dispatcher->trigger('onAfterCartModule');
     if (!empty($result)) {
         $aftercartdisplay = $result[0];
     }
     $Itemid = $comquick2cartHelper->getitemid('index.php?option=com_quick2cart&view=cartcheckout');
     $app = JFactory::getApplication();
     $override = JPATH_BASE . '/templates/' . $app->getTemplate() . '/html/mod_quick2cart/' . $layout . '.php';
     if (JFile::exists($override)) {
         $mod_path = $override;
     } else {
         $mod_path = JPATH_SITE . '/modules/mod_quick2cart/tmpl/' . $layout . '.php';
     }
     ob_start();
     include $mod_path;
     $html = ob_get_contents();
     ob_end_clean();
     return $html;
 }
Пример #3
0
 /**
  * amol changes
  * Get details of checkout cart items
  */
 function getCheckoutCartItemsDetails()
 {
     // GETTING CART ITEMS
     JLoader::import('cart', JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models');
     $cartmodel = new Quick2cartModelcart();
     $cart = $cartmodel->getCartitems();
     foreach ($cart as $key => $rec) {
         JLoader::import('product', JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'models');
         $quick2cartModelProduct = new quick2cartModelProduct();
         $cart[$key]['item_images'] = $quick2cartModelProduct->getProdutImages($rec['item_id']);
         $productHelper = new productHelper();
         // Get cart items attribute details
         $cart[$key]['prodAttributeDetails'] = $productHelper->getItemCompleteAttrDetail($rec['item_id']);
         $product_attributes = rtrim($cart[$key]['product_attributes'], ",");
         if (!empty($product_attributes)) {
             // Get Cart Item attribute seleted value
             if ($cart[$key]['product_attributes']) {
                 $db = JFactory::getDBO();
                 $query = $db->getQuery(true);
                 $query->select("`cartitemattribute_id`, `itemattributeoption_id`, `cartitemattribute_name`");
                 $query->from('#__kart_cartitemattributes');
                 $query->where("itemattributeoption_id IN(" . $product_attributes . ")");
                 $query->where(" cart_item_id = " . $cart[$key]['id']);
                 $db->setQuery($query);
                 $cart[$key]['product_attributes_values'] = $db->loadObjectList('itemattributeoption_id');
             }
         }
     }
     return $cart;
 }
Пример #4
0
 /**
  * Method to give available shipping mehtods list and its detail for cart items.
  *
  * @param   object  $post  Post object .
  *
  * @since   2.2
  * @return   null
  */
 public function getCartItemsShiphDetail($post)
 {
     $productHelper = new productHelper();
     $itemWiseShipDetail = array();
     $shipMethodHtml = '';
     $address = new stdClass();
     $address->billing_address = $post->get('bill', array(), 'ARRAY');
     $address->shipping_address = $post->get('ship', array(), 'ARRAY');
     $address->ship_chk = $post->get('ship_chk', 0);
     $qtcshiphelper = new qtcshiphelper();
     $Quick2cartModelcart = new Quick2cartModelcart();
     $cartitems = $Quick2cartModelcart->getCartitems();
     if (!empty($cartitems)) {
         foreach ($cartitems as $citem) {
             //  Get item's shipping profile id
             $profieId = $this->getItemsShipProfileId($citem['item_id']);
             if (!empty($profieId)) {
                 // Get shipping methods list.
                 $shipMeths = $this->getShipProfileMethods($profieId);
                 if (!empty($shipMeths)) {
                     $shipDetail = array();
                     $shipMethsDetail = array();
                     $shipDetail['item_id'] = $citem['item_id'];
                     // Add current cart item detail
                     $shipDetail['itemDetail'] = $citem;
                     foreach ($shipMeths as $meth) {
                         $methodId = $meth['methodId'];
                         // $shipDetail['shippingMeths'] = $qtcshiphelper->getItemsShipMethods($citem['item_id'], $bill, $ship, $citem, $shipMeths);
                         $shipDetail['shippingMeths'][$methodId] = $qtcshiphelper->getItemsShipMethods($citem['item_id'], $address, $citem, $meth);
                     }
                     $itemWiseShipDetail[] = $shipDetail;
                 }
             }
         }
     }
     $shipMethodHtml = $this->getShipMethodHtml($itemWiseShipDetail);
     return $shipMethodHtml;
 }