Exemplo n.º 1
0
 /**
  * public action
  */
 public function mainAction()
 {
     setlocale(LC_MONETARY, $GLOBALS['onxshop_conf']['global']['locale']);
     /**
      * get product conf
      */
     require_once 'models/ecommerce/ecommerce_product.php';
     $ecommerce_product_conf = ecommerce_product::initConfiguration();
     /**
      * check gift wrap product ID is set
      */
     if (!is_numeric($ecommerce_product_conf['gift_wrap_product_id']) || $ecommerce_product_conf['gift_wrap_product_id'] == 0) {
         msg("You need to create ecommerce_product.gift_wrap_product_id conf option to use gift wrap component", 'error');
         return true;
     }
     /**
      * get gift wrap product detail
      */
     $gift_wrap_product_detail = $this->getGiftWrapProductDetail($ecommerce_product_conf['gift_wrap_product_id']);
     /**
      * display each option
      */
     foreach ($gift_wrap_product_detail['variety'] as $variety) {
         /**
          * image
          */
         //$_Onxshop_Request = new Onxshop_Request("component/image~relation=product_variety:node_id={$variety['id']}:limit=0,1~");
         //$this->tpl->assign('IMAGE', $_Onxshop_Request->getContent());
         $variety['image'] = $this->getImage($variety['id']);
         /**
          * assign to template
          */
         $this->tpl->assign('ITEM', $variety);
         /**
          * check if gift wrap is in the basket
          */
         $gift_selected = $this->checkGiftWrapSelected($variety['id']);
         /**
          * display checked gift wrap
          */
         if ($gift_selected) {
             $this->tpl->assign("CHECKED_gift_wrap", "checked='checked'");
         } else {
             $this->tpl->assign("CHECKED_gift_wrap", "");
         }
         $this->tpl->parse('content.item');
     }
     /**
      * display virtual product option
      */
     if ($this->isBasketVirtualProductOnly()) {
         $this->tpl->parse('content.virtual_product');
     }
     setlocale(LC_MONETARY, LOCALE);
     return true;
 }
Exemplo n.º 2
0
 /**
  * getGiftVoucherProductId
  */
 public function getGiftVoucherProductId()
 {
     /**
      * get product conf
      */
     require_once 'models/ecommerce/ecommerce_product.php';
     $ecommerce_product_conf = ecommerce_product::initConfiguration();
     /**
      * check gift voucher product ID is set
      */
     if (!is_numeric($ecommerce_product_conf['gift_voucher_product_id']) || $ecommerce_product_conf['gift_voucher_product_id'] == 0) {
         msg("ecommerce_product.gift_voucher_product_id conf option is not defined", 'error', 1);
         return false;
     }
     return $ecommerce_product_conf['gift_voucher_product_id'];
 }
Exemplo n.º 3
0
 /**
  * isAllowedReturn
  */
 public function isAllowedItemForReturn($item)
 {
     /**
      * check if quantity was greater than zero (in same cases is possible to checkout with zero quantity ordered)
      */
     if ($item['quantity'] == 0) {
         return false;
     }
     /**
      * check it's a product which can be returned
      */
     require_once 'models/ecommerce/ecommerce_product.php';
     $product_conf = ecommerce_product::initConfiguration();
     switch ($item['product']['id']) {
         case $product_conf['gift_wrap_product_id']:
         case $product_conf['gift_voucher_product_id']:
             return false;
         default:
             return true;
     }
 }