當前位置: 首頁>>代碼示例>>PHP>>正文


PHP J2Store::product方法代碼示例

本文整理匯總了PHP中J2Store::product方法的典型用法代碼示例。如果您正苦於以下問題:PHP J2Store::product方法的具體用法?PHP J2Store::product怎麽用?PHP J2Store::product使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在J2Store的用法示例。


在下文中一共展示了J2Store::product方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onBeforeStore

 protected function onBeforeStore($updateNulls = false)
 {
     if (!isset($this->sku) || empty($this->sku)) {
         //sku is empty. Auto generate it based on product name
         $product_helper = J2Store::product();
         $this->sku = $product_helper->generateSKU($this);
     }
     return parent::onBeforeStore($updateNulls);
 }
開發者ID:jputz12,項目名稱:OneNow-Vshop,代碼行數:9,代碼來源:variant.php

示例2: browse

 public function browse()
 {
     $app = JFactory::getApplication();
     $model = $this->getThisModel();
     $state = $this->getFilterStates();
     foreach ($state as $key => $value) {
         $model->setState($key, $value);
     }
     //$product_types  = $model->getProductTypes();
     //array_unshift($product_types, JText::_('J2STORE_SELECT_OPTION'));
     $products = $model->getStockProductList();
     $product_helper = J2Store::product();
     foreach ($products as $product) {
         $product->product = $product_helper->setId($product->j2store_product_id)->getProduct();
     }
     $view = $this->getThisView();
     $view->setModel($model);
     $view->assign('products', $products);
     $view->assign('state', $model->getState());
     //$view->assign('product_types',$product_types);
     return parent::browse();
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:22,代碼來源:inventories.php

示例3: setpaimport

 function setpaimport()
 {
     $app = JFactory::getApplication();
     $model = $this->getThisModel();
     $view = $this->getThisView();
     $view->setModel($model, true);
     $product_id = $app->input->getInt('product_id', 0);
     if ($product_id) {
         $product_type = $app->input->getString('product_type', 'simple');
         $model->setState('product_type', $product_type);
         $product_list = $model->getProductList();
         $products = array();
         foreach ($product_list as $item) {
             // run the getItem again
             unset($product);
             if (isset($item->has_options) && $item->has_options) {
                 $product = F0FModel::getTmpInstance('Products', 'J2StoreModel')->runMyBehaviorFlag(true)->getItem($item->j2store_product_id);
                 $products[] = $product;
             }
         }
         $items = F0FModel::getTmpInstance('Productoptions', 'J2StoreModel')->getList();
         $total = F0FModel::getTmpInstance('Productoptions', 'J2StoreModel')->getTotal();
         $pagination = F0FModel::getTmpInstance('Productoptions', 'J2StoreModel')->getPagination();
         $view->assign('model', $model);
         $view->assign('state', $model->getState());
         $view->assign('products', $products);
         $row = F0FModel::getTmpInstance('Products', 'J2StoreModel')->getItem($product_id);
         $view->assign('row', $row);
         $view->assign('productHelper', J2Store::product());
         $view->assign('currency', J2Store::currency());
         //$view->assign('lists',$lists);
         $view->assign('total', $total);
         $view->assign('product_id', $product_id);
     }
     $view->setLayout('paimport');
     $view->display();
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:37,代碼來源:productbase.php

示例4: setItems

 public function setItems($cartitems)
 {
     $product_helper = J2Store::product();
     $productitems = array();
     foreach ($cartitems as $cartitem) {
         if ($cartitem->product_qty == 0) {
             F0FModel::getTmpInstance('Cartitems', 'J2StoreModel')->setIds(array($cartitem->j2store_cartitem_id))->delete();
             continue;
         }
         if ($product_helper->managing_stock($cartitem) && $product_helper->backorders_allowed($cartitem) === false) {
             //this could be wrong. we are not checking the total quantity for product types other than variant type
             /* if ($cartitem->product_qty > $cartitem->available_quantity && $cartitem->available_quantity >= 1) {
             				JFactory::getApplication ()->enqueueMessage ( JText::sprintf ( "J2STORE_CART_QUANTITY_ADJUSTED", $cartitem->product_name, $cartitem->product_qty, $cartitem->available_quantity ) );
             				$cartitem->product_qty = $cartitem->available_quantity;
             			} */
             // removing the product from the cart if it's not available
             if ($cartitem->available_quantity == 0) {
                 F0FModel::getTmpInstance('Cartitems', 'J2StoreModel')->setIds(array($cartitem->j2store_cartitem_id))->delete();
                 continue;
             }
         }
         unset($orderItem);
         // TODO Push this into the orders object->addItem() method?
         $orderItem = $this->getTable()->getClone();
         $orderItem->cart_id = $cartitem->cart_id;
         $orderItem->cartitem_id = $cartitem->j2store_cartitem_id;
         $orderItem->product_id = $cartitem->product_id;
         $orderItem->product_source = $cartitem->product_source;
         $orderItem->product_source_id = $cartitem->product_source_id;
         $orderItem->product_type = $cartitem->product_type;
         $orderItem->product_params = $cartitem->product_params;
         $orderItem->variant_id = $cartitem->variant_id;
         $orderItem->orderitem_sku = $cartitem->sku;
         $orderItem->vendor_id = $cartitem->vendor_id;
         $orderItem->orderitem_name = $cartitem->product_name;
         $orderItem->orderitem_quantity = J2Store::utilities()->stock_qty($cartitem->product_qty);
         //set the entire cartitem. We can use it later
         $orderItem->cartitem = $cartitem;
         // price which is not processed
         $orderItem->orderitem_price = $cartitem->pricing->price;
         $orderItem->orderitem_baseprice = $cartitem->pricing->base_price;
         $orderItem->orderitem_option_price = $cartitem->option_price;
         // the following four includes the option prices as well
         //	$orderItem->orderitem_price_with_tax = $cartitem->pricing->price_with_tax;
         //	$orderItem->orderitem_price_without_tax = $cartitem->pricing->price_without_tax;
         //	$orderItem->orderitem_baseprice_with_tax = $cartitem->pricing->base_price_with_tax;
         //	$orderItem->orderitem_baseprice_without_tax = $cartitem->pricing->base_price_without_tax;
         $orderItem->orderitem_taxprofile_id = $cartitem->taxprofile_id;
         $orderItem->orderitem_weight = $cartitem->weight;
         $orderItem->orderitem_weight_total = $cartitem->weight_total;
         //just a placeholder and also used as reference for product options
         $orderItem->orderitem_attributes = $cartitem->product_options;
         $orderItem->orderitem_raw_attributes = $cartitem->product_options;
         //prepare options
         $this->getOrderItemOptions($orderItem, $cartitem);
         //prepare orderitem_params and add some data that might be useful
         $this->getOrderItemParams($orderItem, $cartitem);
         JPluginHelper::importPlugin('j2store');
         $results = JFactory::getApplication()->triggerEvent("onJ2StoreAfterAddCartItemToOrder", array($cartitem));
         foreach ($results as $result) {
             foreach ($result as $key => $value) {
                 $orderItem->set($key, $value);
             }
         }
         J2Store::plugin()->event('AfterAddOrderItem', array(&$orderItem));
         // TODO When do attributes for selected item get set during admin-side order creation?
         array_push($this->_items, $orderItem);
     }
     return $this;
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:70,代碼來源:orderitems.php

示例5: defined

<?php

/**
 * @package J2Store
 * @copyright Copyright (c)2014-17 Ramesh Elamathi / J2Store.org
 * @license GNU GPL v3 or later
 */
// No direct access
defined('_JEXEC') or die;
$options = $this->product->options;
$product_id = $this->product->j2store_product_id;
$product_helper = J2Store::product();
if ($options) {
    ?>

<div class="options">
        <?php 
    foreach ($options as $option) {
        ?>
        
        <?php 
        echo J2Store::plugin()->eventWithHtml('BeforeDisplaySingleProductOption', array($this->product, $option));
        ?>
        
        <?php 
        //var_dump($option);
        ?>
        <?php 
        if ($option['type'] == 'select') {
            ?>
        <!-- select -->
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:31,代碼來源:view_options.php

示例6: view

 public function view()
 {
     $product_id = $this->input->getInt('id');
     if (!$product_id) {
         $this->setRedirect(JRoute::_('index.php'));
         return;
     }
     //first clear cache
     J2Store::utilities()->nocache();
     J2Store::utilities()->clear_cache();
     $app = JFactory::getApplication();
     $view = $this->getThisView();
     if ($model = $this->getThisModel()) {
         // Push the model into the view (as default)
         $view->setModel($model, true);
     }
     $ns = 'com_j2store.' . $this->getName();
     $params = F0FModel::getTmpInstance('Products', 'J2StoreModel')->getMergedParams();
     if ($params->get('item_show_vote', 0)) {
         $params->set('show_vote', 1);
     }
     $product_helper = J2Store::product();
     //get product
     $product = $product_helper->setId($product_id)->getProduct();
     F0FModel::getTmpInstance('Products', 'J2StoreModel')->runMyBehaviorFlag(true)->getProduct($product);
     if ($product->visibility != 1 || $product->enabled != 1) {
         $this->setRedirect(JRoute::_('index.php'), JText::_('J2STORE_PRODUCT_NOT_ENABLED_CONTACT_SITE_ADMIN_FOR_MORE_DETAILS'), 'warning');
         return;
     }
     //run plugin events
     $model->executePlugins($product->source, $params, 'com_content.article.productlist');
     $product->product_short_desc = $model->runPrepareEventOnDescription($product->product_short_desc, $product->product_source_id, $params, 'com_content.article.productlist');
     $product->product_long_desc = $model->runPrepareEventOnDescription($product->product_long_desc, $product->product_source_id, $params, 'com_content.article.productlist');
     //get filters / specs by product
     $filters = F0FModel::getTmpInstance('Products', 'J2StoreModel')->getProductFilters($product->j2store_product_id);
     //upsells
     $up_sells = array();
     if ($params->get('item_show_product_upsells', 0) && !empty($product->up_sells)) {
         $up_sells = $product_helper->getUpsells($product);
     }
     //cross sells
     $cross_sells = array();
     if ($params->get('item_show_product_cross_sells', 0) && !empty($product->cross_sells)) {
         $cross_sells = $product_helper->getCrossSells($product);
     }
     if (!defined('DS')) {
         define('DS', DIRECTORY_SEPARATOR);
     }
     // Look for template files in component folders
     $view->addTemplatePath(JPATH_SITE . '/components/com_j2store/templates');
     $view->addTemplatePath(JPATH_SITE . '/components/com_j2store/templates/default');
     // Look for overrides in template folder (J2 template structure)
     $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store' . DS . 'templates');
     $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store' . DS . 'templates' . DS . 'default');
     // Look for overrides in template folder (Joomla! template structure)
     $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store' . DS . 'default');
     $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store');
     // Look for specific J2 theme files
     if ($params->get('subtemplate')) {
         $view->addTemplatePath(JPATH_COMPONENT . DS . 'templates' . DS . $params->get('subtemplate'));
         $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store' . DS . 'templates' . DS . $params->get('subtemplate'));
         $view->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_j2store' . DS . $params->get('subtemplate'));
     }
     //set up document
     // Check for layout override only if this is not the active menu item
     // If it is the active menu item, then the view and category id will match
     $active = $app->getMenu()->getActive();
     $menus = $app->getMenu();
     $pathway = $app->getPathway();
     $document = JFactory::getDocument();
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     $params->def('page_heading', $product->product_name);
     $params->set('page_title', $product->product_name);
     $title = $params->get('page_title', '');
     // Check for empty title and add site name if param is set
     if (empty($title)) {
         $title = $app->get('sitename');
     } elseif ($app->get('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
     } elseif ($app->get('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
     }
     $document->setTitle($title);
     if ($product->source->metadesc) {
         $document->setDescription($product->source->metadesc);
     } else {
         $metaDescItem = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $product->source->introtext . ' ' . $product->source->fulltext);
         $metaDescItem = strip_tags($metaDescItem);
         $metaDescItem = J2Store::utilities()->characterLimit($metaDescItem, 150);
         $document->setDescription(html_entity_decode($metaDescItem));
     }
     if ($product->source->metakey) {
         $document->setMetadata('keywords', $product->source->metakey);
     } else {
         $keywords = $params->get('menu-meta_keywords');
         $document->setMetaData('keywords', $keywords);
     }
     $metadata = json_decode($product->source->metadata);
//.........這裏部分代碼省略.........
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:101,代碼來源:products.php

示例7:

if (isset($this->product->source->event->beforeDisplayContent)) {
    ?>
					<?php 
    echo $this->product->source->event->beforeDisplayContent;
    ?>
				<?php 
}
?>
					<?php 
echo $this->loadTemplate('sku');
?>
					<?php 
echo $this->loadTemplate('brand');
?>
					<?php 
if ($this->params->get('item_show_product_stock', 1) && J2Store::product()->managing_stock($this->product->variant)) {
    ?>
						<?php 
    echo $this->loadTemplate('stock');
    ?>
					<?php 
}
?>
				</div>
			</div>

			<?php 
if ($this->params->get('catalog_mode', 0) == 0) {
    ?>

			<form action="<?php 
開發者ID:Fabrik,項目名稱:website,代碼行數:31,代碼來源:view_simple.php

示例8: onUpdateProduct

 public function onUpdateProduct(&$model, &$product)
 {
     $app = JFactory::getApplication();
     $product_helper = J2Store::product();
     $params = J2Store::config();
     //first get the correct variant
     $options = $app->input->get('product_option', array(0), 'ARRAY');
     if (isset($options)) {
         $options = array_filter($options);
     } else {
         $options = array();
     }
     //no options found. so just return an empty array
     if (count($options) < 1) {
         return false;
     }
     //options found. Get the correct variant
     $variant = $product_helper->getVariantByOptions($options, $product->j2store_product_id);
     if ($variant === false) {
         return false;
     }
     //now we have the variant. Process.
     //get quantity restrictions
     $product_helper->getQuantityRestriction($variant);
     $quantity = $app->input->getFloat('product_qty', 1);
     if ($variant->quantity_restriction && $variant->min_sale_qty > 0) {
         $quantity = $variant->min_sale_qty > $quantity ? $variant->min_sale_qty : $quantity;
     }
     //check stock status
     if ($product_helper->check_stock_status($variant, $quantity)) {
         //reset the availability
         $variant->availability = 1;
     } else {
         $variant->availability = 0;
     }
     //process pricing. returns an object
     $variant->pricing = $product_helper->getPrice($variant, $quantity);
     //prepare return values
     $return = array();
     $return['variant_id'] = $variant->j2store_variant_id;
     $return['sku'] = $variant->sku;
     $return['quantity'] = floatval($quantity);
     $return['price'] = $variant->price;
     $return['availability'] = $variant->availability;
     $return['manage_stock'] = $variant->manage_stock;
     $return['allow_backorder'] = $variant->allow_backorder;
     if ($variant->availability) {
         $return['stock_status'] = J2Store::product()->displayStock($variant, $params);
     } else {
         $return['stock_status'] = JText::_('J2STORE_OUT_OF_STOCK');
     }
     $return['pricing'] = array();
     $return['pricing']['base_price'] = J2Store::product()->displayPrice($variant->pricing->base_price, $product, $params);
     $return['pricing']['price'] = J2Store::product()->displayPrice($variant->pricing->price, $product, $params);
     //dimensions
     $return['dimensions'] = round($variant->length, 2) . ' x ' . round($variant->height, 2) . ' x ' . round($variant->width, 2) . ' ' . $variant->length_title;
     $return['weight'] = round($variant->weight, 2) . ' ' . $variant->weight_title;
     return $return;
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:59,代碼來源:variable.php

示例9:

                ?>
            <?php 
                if ($option_value['product_optionvalue_price'] > 0 && $this->params->get('product_option_price', 1)) {
                    ?>
               (
               <?php 
                    if ($this->params->get('product_option_price_prefix', 1)) {
                        ?>
            		<?php 
                        echo $option_value['product_optionvalue_prefix'];
                        ?>
            	<?php 
                    }
                    ?>
            	<?php 
                    echo J2Store::product()->displayPrice($option_value['product_optionvalue_price'], $this->product, $this->params);
                    ?>
            	)
            	<?php 
                }
                ?>
          </label>
          <br />
          <?php 
            }
            ?>
        </div>
        <br />

		<script type="text/javascript">
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:30,代碼來源:item_configurableoptions.php

示例10: foreach

        }
        ?>
			<?php 
    }
    ?>

			<?php 
    if ($list['product_count'] > 0) {
        ?>
				<?php 
        foreach ($advanced_list as $item) {
            $registry = new JRegistry();
            $registry->loadString($item->orderitem_params);
            $item->params = $registry;
            $thumb_image = $item->params->get('thumb_image', '');
            $product = J2Store::product()->setId($item->product_id)->getProduct();
            ?>
					<li class="cartitems">
						<div class="item-info">

							<?php 
            if ($params->get('show_thumbimage') && !empty($thumb_image)) {
                ?>
								<span class="cart-thumb-image">
										<img alt="<?php 
                echo $item->orderitem_name;
                ?>
" src="<?php 
                echo JUri::root(true) . '/' . $thumb_image;
                ?>
" />
開發者ID:Fabrik,項目名稱:website,代碼行數:31,代碼來源:detailcartonhover.php

示例11: array

        echo J2Html::label(JText::_('J2STORE_PRODUCT_SET_ADVANCED_PRICING'), 'sale_price', array('class' => 'control-label'));
        ?>
									<?php 
        $url = "index.php?option=com_j2store&view=products&task=setproductprice&variant_id=" . $this->variant->j2store_variant_id . "&layout=productpricing&tmpl=component";
        ?>
									<?php 
        echo J2StorePopup::popup($url, JText::_("J2STORE_PRODUCT_SET_PRICES"), array('class' => 'btn btn-success btn-small'));
        ?>
								</div>
								<div class="control-group">
									<?php 
        echo J2Html::label(JText::_('J2STORE_PRODUCT_PRICING_CALCULATOR'), 'pricing_calculator', array('class' => 'control-label input-small'));
        ?>
									<?php 
        //pricing options
        echo J2Html::select()->clearState()->type('genericlist')->name($prefix . '[pricing_calculator]')->value($this->variant->pricing_calculator)->attribs(array('id' => 'pricing_calculator_' . $this->variant->j2store_variant_id, 'class' => 'input-small'))->setPlaceHolders(J2Store::product()->getPricingCalculators())->getHtml();
        ?>
								</div>


							</div>
							<div class="span6">
								<div class="control-group">
									<?php 
        echo J2Html::label(JText::_('J2STORE_PRODUCT_ENABLE_SHIPPING'), 'shipping', array('class' => 'control-label'));
        ?>
									<?php 
        //  echo J2Html::radio($prefix.'[shipping]', $this->variant->shipping,array('class'=>'controls' ,'id'=> 'shipping-'.$this->variant->j2store_variant_id));
        ?>
									<?php 
        //pricing options
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:31,代碼來源:form_ajax_avoptions.php

示例12:

									<?php 
        //$relatedModel = F0FModel::getAnInstance('Products', 'J2StoreModel')->getClone();
        //$related_product = $relatedModel->getItem($value);
        $product = J2Store::product();
        $related_product = $product->product_id($value)->getProduct();
        ?>
								<?php 
        if (isset($related_product->product_source_id)) {
            ?>
								<tr id="crossSell-<?php 
            echo $value;
            ?>
">
										<td class="addedProductCrosssell">
											<?php 
            $related_product = J2Store::product()->clearState()->product_id($value)->getProduct();
            ?>
											<a href="index.php?option=com_content&task=article.edit&id=<?php 
            echo $related_product->product_source_id;
            ?>
"  target="_blank">
												<?php 
            echo $related_product->product_name;
            ?>
											</a>
											<input type="hidden" value="<?php 
            echo $value;
            ?>
" name="<?php 
            echo $this->form_prefix . '[cross_sells]';
            ?>
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:31,代碼來源:form_relations.php

示例13: validate_order_stock

 /**
  * Method to validate stock in an order. Called only before placing the order.
  * @return boolean True if successful | False if a condition does not match
  */
 public function validate_order_stock()
 {
     $product_helper = J2Store::product();
     $utilities = J2Store::utilities();
     $items = $this->getItems();
     if (count($items) < 1) {
         return true;
     }
     $quantity_in_cart = $this->get_orderitem_stock($items);
     foreach ($items as $item) {
         // check quantity restrictions
         if ($item->cartitem->quantity_restriction && J2Store::isPro()) {
             // get quantity restriction
             $product_helper->getQuantityRestriction($item->cartitem);
             $quantity = $quantity_in_cart[$item->variant_id];
             $min = $item->cartitem->min_sale_qty;
             $max = $item->cartitem->max_sale_qty;
             if ($max && $max > 0) {
                 if ($quantity > $max) {
                     JFactory::getApplication()->enqueueMessage(JText::sprintf("J2STORE_CART_ITEM_MAXIMUM_QUANTITY_REACHED", $item->orderitem_name, $utilities->stock_qty($max), $utilities->stock_qty($quantity)));
                     return false;
                 }
             }
             if ($min && $min > 0) {
                 if ($quantity < $min) {
                     JFactory::getApplication()->enqueueMessage(JText::sprintf("J2STORE_CART_ITEM_MINIMUM_QUANTITY_REQUIRED", $item->orderitem_name, $utilities->stock_qty($min), $utilities->stock_qty($quantity)));
                     return false;
                 }
             }
         }
         if ($product_helper->managing_stock($item->cartitem) && $product_helper->backorders_allowed($item->cartitem) == false) {
             $productQuantity = F0FTable::getInstance('ProductQuantity', 'J2StoreTable')->getClone();
             $productQuantity->load(array('variant_id' => $item->variant_id));
             // no stock, right now?
             if ($productQuantity->quantity < 1) {
                 JFactory::getApplication()->enqueueMessage(JText::sprintf("J2STORE_CART_ITEM_STOCK_NOT_AVAILABLE", $item->orderitem_name));
                 return false;
             }
             // not enough stock ?
             if ($productQuantity->quantity > 0 && $quantity_in_cart[$item->variant_id] > $productQuantity->quantity) {
                 JFactory::getApplication()->enqueueMessage(JText::sprintf("J2STORE_CART_ITEM_STOCK_NOT_ENOUGH_STOCK", $item->orderitem_name, $utilities->stock_qty($productQuantity->quantity)));
                 return false;
             }
         }
     }
     return true;
 }
開發者ID:afend,項目名稱:RULug,代碼行數:51,代碼來源:order.php

示例14: get_discount_amount

 public function get_discount_amount($discounting_amount, $cartitem, $order, $single = true)
 {
     $discount = 0;
     $app = JFactory::getApplication();
     $params = J2Store::config();
     $session = JFactory::getSession();
     $sub_total = $order->subtotal;
     if ($this->coupon->value_type == 'F') {
         $this->coupon->value = min($this->coupon->value, $sub_total);
     }
     if ($this->coupon->value_type == 'F') {
         //TODO: Not sure this is correct. We have to apply the right discount value.
         $discount_percent = 0;
         if ($order->subtotal_ex_tax) {
             $product_helper = J2Store::product();
             $actual_price = $cartitem->orderitem_price + $cartitem->orderitem_option_price;
             $price_for_discount = $product_helper->get_price_excluding_tax($actual_price * $cartitem->orderitem_quantity, $cartitem->orderitem_taxprofile_id);
             $discount_percent = $price_for_discount / $order->subtotal_ex_tax;
             $discount = min($this->coupon->value * $discount_percent / $cartitem->orderitem_quantity, $discounting_amount);
         }
         //$discount = $this->coupon->value * ($discounting_amount / $sub_total);
     } elseif ($this->coupon->value_type == 'P') {
         $discount = $discounting_amount / 100 * $this->coupon->value;
     }
     //has free shipping
     if ($this->coupon->free_shipping) {
         $order->allow_free_shipping();
     }
     //allow plugins to modify the amount
     J2Store::plugin()->event('GetCouponDiscountAmount', array($discount, $discounting_amount, $cartitem, $order, $this, $single));
     return $discount;
 }
開發者ID:afend,項目名稱:RULug,代碼行數:32,代碼來源:coupons.php

示例15:

        ?>
)"
									 href="javascript:void(0);" >
									<i class="icon icon-trash"></i>
								</a>
							</div>
							#<?php 
        echo $this->variant->j2store_variant_id;
        ?>
--
							<a data-toggle="collapse" data-parent="#accordion" href="#collapse<?php 
        echo $this->variant->j2store_variant_id;
        ?>
">
							<?php 
        echo J2Store::product()->getVariantNamesByCSV($this->variant->variant_name);
        ?>
								<i
									id="icon-downarrow-<?php 
        echo $this->variant->j2store_variant_id;
        ?>
"
									class="icon-arrow-down"
									onclick="jQuery('#icon-uparrow-<?php 
        echo $this->variant->j2store_variant_id;
        ?>
').toggle('click');jQuery('#icon-downarrow-<?php 
        echo $this->variant->j2store_variant_id;
        ?>
').toggle('click');"
									data-toggle-tag="icon-uparrow-<?php 
開發者ID:jputz12,項目名稱:OneNow-Vshop,代碼行數:31,代碼來源:form_ajax_avoptions.php


注:本文中的J2Store::product方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。