Esempio n. 1
0
 public function onBeforeDispatch()
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         $layout = new JLayoutFile('joomla.sidebars.submenu');
         $layout->addIncludePaths(JPATH_ADMINISTRATOR . '/components/com_j2store/layouts');
     }
     require_once JPATH_ADMINISTRATOR . '/components/com_j2store/helpers/strapper.php';
     J2StoreStrapper::addJS();
     J2StoreStrapper::addCSS();
     require_once JPATH_ADMINISTRATOR . '/components/com_j2store/helpers/j2store.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_j2store/library/popup.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_j2store/helpers/select.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_j2store/helpers/j2html.php';
     return parent::onBeforeDispatch();
 }
Esempio n. 2
0
 public function get_product_price_html($type = 'price')
 {
     $html = '';
     if (empty($this->j2store_product_id)) {
         return $html;
     }
     //ok. We have a product.
     $view = $this->get_view();
     $product = $this->get_product();
     $model = F0FModel::getTmpInstance('Products', 'J2StoreModel');
     $view->setModel($model, true);
     $model->setState('task', 'read');
     J2StoreStrapper::addJS();
     J2StoreStrapper::addCSS();
     $params = J2Store::config();
     switch ($type) {
         case 'price':
         default:
             $params->set('show_base_price', 1);
             $params->set('show_price_field', 1);
             break;
         case 'saleprice':
             $params->set('show_base_price', 0);
             $params->set('show_price_field', 1);
             break;
         case 'regularprice':
             $params->set('show_base_price', 1);
             $params->set('show_price_field', 0);
             break;
     }
     $view->assign('product', $product);
     $view->assign('params', $params);
     $view->setLayout('item_price');
     ob_start();
     $view->display();
     $html = ob_get_contents();
     ob_end_clean();
     return $html;
 }
Esempio n. 3
0
<?php

/*------------------------------------------------------------------------
# mod_j2store_cart - J2 Store Cart
# ------------------------------------------------------------------------
# author    Sasi varna kumar - Weblogicx India http://www.weblogicxindia.com
# copyright Copyright (C) 2014 - 19 Weblogicxindia.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://j2store.org
# Technical Support:  Forum - http://j2store.org/forum/index.html
-------------------------------------------------------------------------*/
// no direct access
defined('_JEXEC') or die('Restricted access');
require_once JPATH_ADMINISTRATOR . '/components/com_j2store/helpers/strapper.php';
J2StoreStrapper::addJS();
$action = JRoute::_('index.php');
?>
<script type="text/javascript">
<!--
if(typeof(j2store) == 'undefined') {
	var j2store = {};
}
if(typeof(j2store.jQuery) == 'undefined') {
	j2store.jQuery = jQuery.noConflict();
}

//-->
</script>

<style type="text/css">
#j2store_currency {
Esempio n. 4
0
 public static function getAjaxCart($item, $values = array())
 {
     $app = JFactory::getApplication();
     if (is_array($values) && !count($values)) {
         $values = $app->input->getArray($_REQUEST);
     }
     //load javascript files
     require_once JPATH_ADMINISTRATOR . '/components/com_j2store/helpers/strapper.php';
     J2StoreStrapper::addJS();
     J2StoreStrapper::addCSS();
     $html = '';
     JLoader::register("J2StoreViewMyCart", JPATH_SITE . "/components/com_j2store/views/mycart/view.html.php");
     $layout = 'addtocart';
     $view = new J2StoreViewMyCart();
     $view->addTemplatePath(JPATH_SITE . '/components/com_j2store/views/mycart/tmpl');
     $view->addTemplatePath(JPATH_SITE . '/templates/' . $app->getTemplate() . '/html/com_j2store/mycart');
     require_once JPATH_SITE . '/components/com_j2store/models/mycart.php';
     $model = new J2StoreModelMyCart();
     $product_id = $item->product_id = $item->id;
     $view->assign('_basePath', JPATH_SITE . '/components/com_j2store');
     $view->set('_controller', 'mycart');
     $view->set('_view', 'mycart');
     $view->set('_doTask', true);
     $view->set('hidemenu', true);
     $view->setModel($model, true);
     $view->setLayout($layout);
     $view->assign('product_id', $product_id);
     $config = JComponentHelper::getParams('com_j2store');
     $show_tax = $config->get('show_tax_total', '1');
     //	$show_attributes = $config->get( 'show_product_attributes', 1);
     $view->assign('show_tax', $show_tax);
     $view->assign('params', $config);
     //$view->assign( 'show_attributes', $show_attributes );
     //get j2store fields
     $item->product = $product = self::getItemInfo($product_id);
     $item->attribs = $product->product->attribs;
     //quantity
     if (isset($product->min_sale_qty) && $product->min_sale_qty > 1 && J2STORE_PRO == 1) {
         $item->product_quantity = (int) $product->min_sale_qty;
         $item->item_minimum_notice = JText::sprintf('J2STORE_MINIMUM_QUANTITY_NOTIFICATION', $product->product_name, (int) $product->min_sale_qty);
     } else {
         $item->product_quantity = 1;
     }
     //get attributes
     $attributes = $model->getProductOptions($product_id);
     if (count($attributes) && $product->manage_stock == 1 && J2STORE_PRO == 1 && !$config->get('allow_backorder', 0)) {
         //get unavailable attribute options
         $attributes = $model->processAttributeOptions($attributes, $product);
         //print_r($attributes );
     }
     //get prices
     $item->prices = J2StorePrices::getPrice($product_id, $item->product_quantity);
     //tax
     $t = new J2StoreTax();
     //assign tax class to the view. so that we dont have to call it everytime.
     $view->assign('tax_class', $t);
     if (isset($item->prices->product_specialprice) && $item->prices->product_specialprice > 0) {
         $item->special_price = $item->prices->product_specialprice;
     } elseif (isset($item->prices->product_customer_groupprice) && $item->prices->product_customer_groupprice >= 0) {
         $item->special_price = $item->prices->product_customer_groupprice;
     } else {
         $item->special_price = null;
     }
     $sp_tax = $t->getProductTax($item->special_price, $item->product_id);
     $item->sp_tax = isset($sp_tax) ? $sp_tax : 0;
     if ($item->special_price) {
         //we have an offer
         $item->price = $item->prices->product_baseprice;
     } else {
         $item->price = $item->prices->product_price;
     }
     $tax = $t->getProductTax($item->price, $item->product_id);
     $item->tax = isset($tax) ? $tax : 0;
     //now get the total stock
     if (J2STORE_PRO == 1 && $product->manage_stock == 1) {
         JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_j2store/models');
         $qtyModel = JModelLegacy::getInstance('ProductQuantities', 'J2StoreModel');
         $qtyModel->setState('filter_product', $item->product_id);
         if ($config->get('show_option_stock', 0)) {
             $qtyModel->setState('filter_productid', $item->product_id);
             $item->option_stock = $qtyModel->getList();
         }
         $item->product_stock = $qtyModel->getQuantityTotal();
     } else {
         $item->product_stock = '';
     }
     //item sku
     $item->product_sku = $product->item_sku;
     $view->assign('product', $product);
     $view->assign('attributes', $attributes);
     $view->assign('params', $config);
     $view->assign('item', $item);
     ob_start();
     $view->display();
     $html = ob_get_contents();
     ob_end_clean();
     return $html;
 }