Beispiel #1
0
 public static function setInventory($orderpayment_id, $order_state_id)
 {
     //only reduce the inventory if the order is successful. 1==CONFIRMED.
     //do it only once.
     $app = JFactory::getApplication();
     JPluginHelper::importPlugin('j2store');
     if ($order_state_id == 1) {
         require_once JPATH_SITE . '/components/com_j2store/models/orders.php';
         $model = new J2StoreModelOrders();
         //lets set the id first
         $model->setId($orderpayment_id);
         $orderTable = $model->getTable('orders');
         $orderTable->load($model->getId());
         $order = $model->getItem();
         //trigger the plugin
         $app->triggerEvent("onJ2StoreBeforeInventory", array($order->id));
         //Do it once and set that the stock is adjusted
         if ($order->stock_adjusted != 1 && is_array($order->orderitems)) {
             foreach ($order->orderitems as $item) {
                 J2StoreInventory::updateProductQuantities($item);
             }
             $orderTable->stock_adjusted = 1;
             $orderTable->store();
             //trigger the plugin
             $app->triggerEvent("onJ2StoreAfterInventory", array($orderTable->id));
         }
     } else {
         return;
     }
     return;
 }
Beispiel #2
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('*');
     $query->from('#__j2store_storeprofiles');
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     if (count($rows) < 1) {
         $redirect_url = 'index.php?option=com_j2store&view=postconfig';
         $app->redirect($redirect_url);
     }
     $model = $this->getModel('cpanel');
     $model->checkCurrency();
     //fix indexes
     $model->fixIndexes();
     $params = JComponentHelper::getParams('com_j2store');
     $this->assignRef('params', $params);
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/orders.php';
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/library/prices.php';
     $order_model = new J2StoreModelOrders();
     $order_model->setState('filter_limit', 5);
     $latest_items = $order_model->getOrders();
     $this->orders = $latest_items;
     $this->order_model = $order_model;
     $this->params = $params;
     $this->addToolBar();
     $toolbar = new J2StoreToolBar();
     $toolbar->renderLinkbar();
     parent::display($tpl);
 }
Beispiel #3
0
 function display($tpl = null)
 {
     $data = array();
     require_once JPATH_ADMINISTRATOR . '/components/com_j2store/models/orders.php';
     $model = new J2StoreModelOrders();
     $model->export($data, true);
     JFactory::getApplication()->close();
 }
Beispiel #4
0
 public static function getOrder($order_id)
 {
     require_once JPATH_SITE . '/components/com_j2store/models/orders.php';
     $model = new J2StoreModelOrders();
     //lets set the id first
     $model->setId($order_id);
     $order = $model->getTable('orders');
     $order->load($model->getId());
     $orderitems = $order->getItems();
     $row = $model->getItem();
     $shipping_info = $model->getShippingInfo($row);
     $object = new JObject();
     $object->order = $row;
     $object->orderitems = $orderitems;
     $object->shipping = $shipping_info;
     $object->ordertaxes = $order->getOrderTax();
     return $object;
 }
<?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 dirname(__FILE__) . '/helper.php';
JFactory::getLanguage()->load('com_j2store', JPATH_SITE);
$moduleclass_sfx = $params->get('moduleclass_sfx', '');
$link_type = $params->get('link_type', 'link');
$params = JComponentHelper::getParams('com_j2store');
require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/orders.php';
$order_model = new J2StoreModelOrders();
$order_model->setState('filter_limit', 5);
$orders = $order_model->getOrders();
require JModuleHelper::getLayoutPath('mod_j2store_orders');
Beispiel #6
0
 function viewtxnlog()
 {
     $app = JFactory::getApplication();
     if (!$app->isAdmin()) {
         echo JText::_('J2STORE_ERROR_NO_PERMISSION');
         $app->close();
         return;
     }
     require_once JPATH_SITE . '/components/com_j2store/models/orders.php';
     $orders_model = new J2StoreModelOrders();
     $id = JRequest::getVar('id');
     $orders_model->setId($id);
     $row = $orders_model->getItem();
     $view = $this->getView('orders', 'html');
     $view->assign('row', $row);
     $view->setLayout('txnlog');
     $view->display();
 }