当前位置: 首页>>代码示例>>PHP>>正文


PHP Isotope::getCart方法代码示例

本文整理汇总了PHP中Isotope\Isotope::getCart方法的典型用法代码示例。如果您正苦于以下问题:PHP Isotope::getCart方法的具体用法?PHP Isotope::getCart怎么用?PHP Isotope::getCart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Isotope\Isotope的用法示例。


在下文中一共展示了Isotope::getCart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 /**
  * Generate the checkout step
  *
  * @return string
  */
 public function generate()
 {
     $objTemplate = new Template($this->objModule->iso_collectionTpl);
     $objOrder = Isotope::getCart()->getDraftOrder();
     $objOrder->addToTemplate($objTemplate, array('gallery' => $this->objModule->iso_gallery, 'sorting' => $objOrder->getItemsSortingCallable($this->objModule->iso_orderCollectionBy)));
     return $objTemplate->parse();
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:12,代码来源:OrderProducts.php

示例2: generate

 /**
  * Generate the checkout step
  * @return  string
  */
 public function generate()
 {
     // Make sure field data is available
     \Controller::loadDataContainer('tl_iso_product_collection');
     \System::loadLanguageFile('tl_iso_product_collection');
     $objTemplate = new Template($this->strTemplate);
     $varValue = null;
     $objWidget = new FormTextArea(FormTextArea::getAttributesFromDca($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField], $this->strField, $varValue, $this->strField, $this->strTable, $this));
     $objWidget->storeValues = true;
     if (\Input::post('FORM_SUBMIT') == $this->strFormId) {
         $objWidget->validate();
         $varValue = $objWidget->value;
         // Do not submit the field if there are errors
         if ($objWidget->hasErrors()) {
             $doNotSubmit = true;
         } elseif ($objWidget->submitInput()) {
             $objOrder = Isotope::getCart()->getDraftOrder();
             // Store the form data
             $_SESSION['FORM_DATA'][$this->strField] = $varValue;
             // Set the correct empty value (see #6284, #6373)
             if ($varValue === '') {
                 $varValue = $objWidget->getEmptyValue();
             }
             // Set the new value
             if ($varValue !== $objOrder->{$this->strField}) {
                 $objOrder->{$this->strField};
             }
         }
     }
     $objTemplate->headline = $GLOBALS['TL_LANG'][$this->strTable][$this->strField][0];
     $objTemplate->customerNotes = $objWidget->parse();
     return $objTemplate->parse();
 }
开发者ID:intelligentspark,项目名称:isotope_checkout_step_order_notes,代码行数:37,代码来源:OrderNotes.php

示例3: generate

 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ISOTOPE ECOMMERCE: STORE CONFIG SWICHER ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->iso_config_ids = deserialize($this->iso_config_ids);
     if (!is_array($this->iso_config_ids) || !count($this->iso_config_ids)) {
         // Can't use empty() because its an object property (using __get)
         return '';
     }
     if (\Input::get('config') != '') {
         if (in_array(\Input::get('config'), $this->iso_config_ids)) {
             Isotope::getCart()->config_id = \Input::get('config');
             Isotope::getCart()->save();
         }
         \Controller::redirect(preg_replace('@[?|&]config=' . \Input::get('config') . '@', '', \Environment::get('request')));
     }
     return parent::generate();
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:29,代码来源:ConfigSwitcher.php

示例4: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $objCart = Isotope::getCart();
     $objAddress = $objCart->getShippingAddress();
     $this->Template->showResults = false;
     $this->Template->requiresShipping = false;
     // There is no address
     if (!$objAddress->id) {
         return;
     }
     $this->Template->showResults = true;
     $arrMethods = array();
     // Get the shipping methods
     if ($objAddress->id && $objCart->requiresShipping()) {
         $this->Template->requiresShipping = true;
         $objShippingMethods = Shipping::findMultipleByIds($this->arrShippingMethods);
         /* @var Shipping $objShipping */
         foreach ($objShippingMethods as $objShipping) {
             if ($objShipping->isAvailable()) {
                 $fltPrice = $objShipping->getPrice();
                 $arrMethods[] = array('label' => $objShipping->getLabel(), 'price' => $fltPrice, 'formatted_price' => Isotope::formatPriceWithCurrency($fltPrice), 'shipping' => $objShipping);
             }
         }
         RowClass::withKey('rowClass')->addCount('row_')->addFirstLast('row_')->addEvenOdd('row_')->applyTo($arrMethods);
     }
     $this->Template->shippingMethods = $arrMethods;
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:30,代码来源:ShippingCalculator.php

示例5: addOrderCondition

 /**
  * Automatically add Billpay conditions to checkout form
  *
  * @param Form    $objForm
  * @param \Module $objModule
  */
 public static function addOrderCondition(Form $objForm, \Module $objModule)
 {
     if (Isotope::getCart()->hasPayment() && Isotope::getCart()->getPaymentMethod() instanceof BillpayWithSaferpay) {
         $strLabel = $GLOBALS['TL_LANG']['MSC']['billpay_agb_' . Isotope::getCart()->getBillingAddress()->country];
         if ($strLabel == '') {
             throw new \LogicException('Missing BillPay AGB for country "' . Isotope::getCart()->getBillingAddress()->country . '" and language "' . $GLOBALS['TL_LANGUAGE'] . '"');
         }
         $objForm->addFormField('billpay_confirmation', array('label' => array('', $strLabel), 'inputType' => 'checkbox', 'eval' => array('mandatory' => true)));
     }
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:16,代码来源:BillpayWithSaferpay.php

示例6: addToCart

 /**
  * Callback for add_to_cart button
  *
  * @param IsotopeProduct $objProduct
  * @param array          $arrConfig
  */
 public function addToCart(IsotopeProduct $objProduct, array $arrConfig = array())
 {
     $objModule = $arrConfig['module'];
     $intQuantity = $objModule->iso_use_quantity && intval(\Input::post('quantity_requested')) > 0 ? intval(\Input::post('quantity_requested')) : 1;
     // Do not add parent of variant product to the cart
     if ($objProduct->hasVariants() && !$objProduct->isVariant()) {
         return;
     }
     if (Isotope::getCart()->addProduct($objProduct, $intQuantity, $arrConfig) !== false) {
         Message::addConfirmation($GLOBALS['TL_LANG']['MSC']['addedToCart']);
         if (!$objModule->iso_addProductJumpTo) {
             $this->reload();
         }
         \Controller::redirect(\Haste\Util\Url::addQueryString('continue=' . base64_encode(\Environment::get('request')), $objModule->iso_addProductJumpTo));
     }
 }
开发者ID:bytehead,项目名称:core,代码行数:22,代码来源:Frontend.php

示例7: getPrice

 /**
  * Return calculated price for this shipping method
  * @param IsotopeProductCollection
  * @return float
  */
 public function getPrice(IsotopeProductCollection $objCollection = null)
 {
     if (null === $objCollection) {
         $objCollection = Isotope::getCart();
     }
     $strPrice = $this->arrData['price'];
     if ($this->isPercentage()) {
         $fltSurcharge = (double) substr($strPrice, 0, -1);
         $fltPrice = $objCollection->subTotal / 100 * $fltSurcharge;
     } else {
         $fltPrice = (double) $strPrice;
     }
     //Make Call to UPS API to retrieve pricing
     $fltPrice += $this->getLiveRateQuote($objCollection);
     return Isotope::calculatePrice($fltPrice, $this, 'fedex', $this->arrData['tax_class']);
 }
开发者ID:rhymedigital,项目名称:isotope_fedexshipping,代码行数:21,代码来源:FedEx.php

示例8: generate

 /**
  * Generate the checkout step
  * @return  string
  */
 public function generate()
 {
     $objTemplate = new Template($this->strTemplate);
     $arrAttributes = ['dateDirection' => 'gtToday', 'inputType' => 'calendar', 'eval' => ['required' => true, 'rgxp' => 'date', 'datepicker' => true]];
     $varValue = null;
     $objWidget = new FormCalendarField(FormCalendarField::getAttributesFromDca($arrAttributes, $this->strField, $varValue, $this->strField, $this->strTable, $this));
     $objWidget->storeValues = true;
     if (\Input::post('FORM_SUBMIT') == $this->strFormId) {
         $objWidget->validate();
         $varValue = $objWidget->value;
         $rgxp = $arrAttributes['eval']['rgxp'];
         // Convert date formats into timestamps (check the eval setting first -> #3063)
         if ($varValue != '' && in_array($rgxp, array('date', 'time', 'datim'))) {
             try {
                 $objDate = new \Date($varValue, \Date::getFormatFromRgxp($rgxp));
                 $varValue = $objDate->tstamp;
             } catch (\OutOfBoundsException $e) {
                 $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalidDate'], $varValue));
             }
         }
         // Do not submit the field if there are errors
         if ($objWidget->hasErrors()) {
             $doNotSubmit = true;
         } elseif ($objWidget->submitInput()) {
             $objOrder = Isotope::getCart()->getDraftOrder();
             // Store the form data
             $_SESSION['FORM_DATA'][$this->strField] = $varValue;
             // Set the correct empty value (see #6284, #6373)
             if ($varValue === '') {
                 $varValue = $objWidget->getEmptyValue();
             }
             // Set the new value
             if ($varValue !== $objOrder->{$this->strField}) {
                 $objOrder->{$this->strField};
             }
         }
     }
     $objTemplate->headline = $GLOBALS['TL_LANG'][$this->strTable]['date_picker'][0];
     $objTemplate->datePicker = $objWidget->parse();
     return $objTemplate->parse();
 }
开发者ID:intelligentspark,项目名称:isotope_checkout_step_delivery_date,代码行数:45,代码来源:DeliveryDate.php

示例9: calculateGrossPrice

 /**
  * Calculate a price, add all applicable taxes
  * @param  float
  * @param  array|null
  * @return float
  */
 public function calculateGrossPrice($fltPrice, $arrAddresses = null)
 {
     if (!is_array($arrAddresses)) {
         $arrAddresses = array('billing' => Isotope::getCart()->getBillingAddress(), 'shipping' => Isotope::getCart()->getShippingAddress());
     }
     /** @var \Isotope\Model\TaxRate $objIncludes */
     if (($objIncludes = $this->getRelated('includes')) !== null && !$objIncludes->isApplicable($fltPrice, $arrAddresses)) {
         $fltPrice -= $objIncludes->calculateAmountIncludedInPrice($fltPrice);
     }
     if (($objRates = $this->getRelated('rates')) !== null) {
         /** @var \Isotope\Model\TaxRate $objTaxRate */
         foreach ($objRates as $objTaxRate) {
             if ($objTaxRate->isApplicable($fltPrice, $arrAddresses)) {
                 $fltPrice += $objTaxRate->calculateAmountAddedToPrice($fltPrice);
                 if ($objTaxRate->stop) {
                     break;
                 }
             }
         }
     }
     return $fltPrice;
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:28,代码来源:TaxClass.php

示例10: getPrice

 /**
  * Return calculated price for this shipping method
  * @return float
  */
 public function getPrice(IsotopeProductCollection $objCollection = null)
 {
     if (null === $objCollection) {
         $objCollection = Isotope::getCart();
     }
     if ($this->isPercentage()) {
         $fltPrice = $objCollection->getSubtotal() / 100 * $this->getPercentage();
     } else {
         $fltPrice = (double) $this->arrData['price'];
     }
     if ($this->flatCalculation == 'perProduct' || $this->flatCalculation == 'perItem') {
         $arrItems = $objCollection->getItems();
         $intMultiplier = 0;
         foreach ($arrItems as $objItem) {
             if (!$objItem->hasProduct() || $objItem->getProduct()->isExemptFromShipping()) {
                 continue;
             }
             $intMultiplier += $this->flatCalculation == 'perProduct' ? 1 : $objItem->quantity;
         }
         $fltPrice = $fltPrice * $intMultiplier;
     }
     return Isotope::calculatePrice($fltPrice, $this, 'price', $this->arrData['tax_class']);
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:27,代码来源:Flat.php

示例11: prepareFISParams

 /**
  * Prepare FIS params
  * @param   Order
  * @return  array
  */
 private function prepareFISParams($objOrder)
 {
     $objBillingAddress = $objOrder->getBillingAddress();
     $objShippingAddress = $objOrder->getShippingAddress();
     $arrInvoice = array('ECOM_BILLTO_POSTAL_NAME_FIRST' => substr($objBillingAddress->firstname, 0, 50), 'ECOM_BILLTO_POSTAL_NAME_LAST' => substr($objBillingAddress->lastname, 0, 50), 'ECOM_SHIPTO_POSTAL_STREET_LINE1' => $objShippingAddress->street_1, 'ECOM_SHIPTO_POSTAL_POSTALCODE' => $objShippingAddress->postal, 'ECOM_SHIPTO_POSTAL_CITY' => $objShippingAddress->city, 'ECOM_SHIPTO_POSTAL_COUNTRYCODE' => strtoupper($objShippingAddress->country), 'ECOM_SHIPTO_DOB' => date('d/m/Y', $objShippingAddress->dateOfBirth), 'REF_CUSTOMERID' => substr('psp_' . $this->id . '_' . $objOrder->id . '_' . $objOrder->uniqid, 0, 17), 'ECOM_CONSUMER_GENDER' => $objBillingAddress->gender == 'male' ? 'M' : 'F');
     $arrOrder = array();
     $i = 1;
     // Need to take the items from the cart as they're not transferred to the order here yet
     foreach (Isotope::getCart()->getItems() as $objItem) {
         $objPrice = $objItem->getProduct()->getPrice();
         $fltVat = Isotope::roundPrice(100 / $objPrice->getNetAmount() * $objPrice->getGrossAmount() - 100, false);
         $arrOrder['ITEMID' . $i] = $objItem->id;
         $arrOrder['ITEMNAME' . $i] = substr($objItem->getName(), 40);
         $arrOrder['ITEMPRICE' . $i] = $objPrice->getNetAmount();
         $arrOrder['ITEMQUANT' . $i] = $objItem->quantity;
         $arrOrder['ITEMVATCODE' . $i] = $fltVat . '%';
         $arrOrder['ITEMVAT' . $i] = Isotope::roundPrice($objPrice->getGrossAmount() - $objPrice->getNetAmount(), false);
         $arrOrder['FACEXCL' . $i] = $objPrice->getNetAmount();
         $arrOrder['FACTOTAL' . $i] = $objPrice->getGrossAmount();
         ++$i;
     }
     return array_merge($arrInvoice, $arrOrder);
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:28,代码来源:Postfinance.php

示例12: getPrice

 /**
  * Return calculated price for this shipping method
  * @return float
  */
 public function getPrice(IsotopeProductCollection $objCollection = null)
 {
     if (null === $objCollection) {
         $objCollection = Isotope::getCart();
     }
     if ($this->or_pricing == '1') {
         $fltAltPrice = $objCollection->subTotal - $objCollection->subTotal / (1 + floatval($this->alternative_price) / 100);
         switch ($this->alternative_price_logic) {
             case '1':
                 //less
                 $fltPrice = $this->arrData['price'] < $fltAltPrice ? $this->arrData['price'] : $fltAltPrice;
                 break;
             case '2':
                 //greater
                 $fltPrice = $this->arrData['price'] > $fltAltPrice ? $this->arrData['price'] : $fltAltPrice;
                 break;
         }
         return $fltPrice;
     } else {
         return $this->arrData['price'];
     }
     return Isotope::calculatePrice($fltPrice, $this, 'price', $this->arrData['tax_class']);
 }
开发者ID:intelligentspark,项目名称:isotope_shipping_zones_advanced,代码行数:27,代码来源:ZonesAdvanced.php

示例13: complete

 /**
  * Complete order if the checkout has been made. This will cleanup session data
  *
  * @return bool
  */
 public function complete()
 {
     if ($this->isCheckoutComplete()) {
         unset($_SESSION['FORM_DATA']);
         unset($_SESSION['FILES']);
         // Retain custom config ID
         if (($objCart = Isotope::getCart()) !== null && $objCart->config_id != $this->config_id) {
             $objCart->config_id = $this->config_id;
         }
         return true;
     }
     return false;
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:18,代码来源:Order.php

示例14: createForMember

 /**
  * Create a new address for a member and automatically set default properties
  * @param   int
  * @param   array|null
  * @return  Address
  */
 public static function createForMember($intMember, $arrFill = null)
 {
     $objAddress = new Address();
     $arrData = array('pid' => $intMember, 'ptable' => 'tl_member', 'tstamp' => time(), 'store_id' => Isotope::getCart()->store_id);
     if (!empty($arrFill) && is_array($arrFill) && ($objMember = \MemberModel::findByPk($intMember)) !== null) {
         $arrData = array_intersect_key(array_merge($objMember->row(), $arrData, array('street_1' => $objMember->street, 'subdivision' => strtoupper($objMember->country . '-' . $objMember->state))), array_flip($arrFill));
     }
     $objAddress->setRow($arrData);
     return $objAddress;
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:16,代码来源:Address.php

示例15: createForMember

 /**
  * Create a new address for a member and automatically set default properties
  *
  * @param int        $intMember
  * @param array|null $arrFill
  *
  * @return static
  */
 public static function createForMember($intMember, $arrFill = null)
 {
     $objAddress = new static();
     $arrData = array('pid' => $intMember, 'ptable' => 'tl_member', 'tstamp' => time(), 'store_id' => (int) Isotope::getCart()->store_id);
     if (!empty($arrFill) && is_array($arrFill) && ($objMember = \MemberModel::findByPk($intMember)) !== null) {
         // Generate address data from tl_member, limit to fields enabled in the shop configuration
         $arrMember = array_intersect_key(array_merge($objMember->row(), array('street_1' => $objMember->street, 'subdivision' => strtoupper($objMember->country . '-' . $objMember->state))), array_flip($arrFill));
         $arrData = array_merge($arrMember, $arrData);
     }
     $objAddress->setRow($arrData);
     return $objAddress;
 }
开发者ID:bytehead,项目名称:core,代码行数:20,代码来源:Address.php


注:本文中的Isotope\Isotope::getCart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。