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


PHP ShoppingCart::config方法代码示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     // If no shopping cart doesn't exist, redirect to base
     if (!ShoppingCart::create()->getItems()->exists()) {
         return $this->redirect(ShoppingCart::config()->url_segment);
     }
 }
开发者ID:i-lateral,项目名称:silverstripe-checkout,代码行数:8,代码来源:Checkout_Controller.php

示例2: __construct

 public function __construct($controller, $name = "BillingDetailsForm")
 {
     $personal_fields = CompositeField::create(HeaderField::create('PersonalHeader', _t('Commerce.PersonalDetails', 'Personal Details'), 3), TextField::create('FirstName', _t('Commerce.FirstName', 'First Name(s)') . '*'), TextField::create('Surname', _t('Commerce.Surname', 'Surname') . '*'), TextField::create("Company", _t('Commerce.Company', "Company")), EmailField::create('Email', _t('Commerce.Email', 'Email') . '*'), TextField::create('PhoneNumber', _t('Commerce.Phone', 'Phone Number')))->setName("PersonalFields")->addExtraClass('unit')->addExtraClass('size1of2')->addExtraClass('unit-50');
     $address_fields = CompositeField::create(HeaderField::create('AddressHeader', _t('Commerce.Address', 'Address'), 3), TextField::create('Address1', _t('Commerce.Address1', 'Address Line 1') . '*'), TextField::create('Address2', _t('Commerce.Address2', 'Address Line 2')), TextField::create('City', _t('Commerce.City', 'City') . '*'), TextField::create('PostCode', _t('Commerce.PostCode', 'Post Code') . '*'), CountryDropdownField::create('Country', _t('Commerce.Country', 'Country') . '*', null, 'GB')->setAttribute("class", 'countrydropdown dropdown btn'))->setName("AddressFields")->addExtraClass('unit')->addExtraClass('size1of2')->addExtraClass('unit-50');
     $fields = FieldList::create(CompositeField::create($personal_fields, $address_fields)->setName("BillingFields")->addExtraClass('line')->addExtraClass('units-row'));
     // Add a save address for later checkbox if a user is logged in
     if (Member::currentUserID()) {
         $fields->add(CompositeField::create(CheckboxField::create("SaveAddress", _t('Commerce.SaveAddress', 'Save this address for later')))->setName("SaveAddressHolder")->addExtraClass('line')->addExtraClass('units-row'));
     }
     $back_url = Controller::join_links(BASE_URL, ShoppingCart::config()->url_segment);
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red commerce-action-back">' . _t('Commerce.Back', 'Back') . '</a>'), FormAction::create('doSetDelivery', _t('Commerce.SetDeliveryAddress', 'Deliver to another address'))->addExtraClass('btn')->addExtraClass('commerce-action-next'), FormAction::create('doContinue', _t('Commerce.DeliverThisAddress', 'Deliver to this address'))->addExtraClass('btn')->addExtraClass('commerce-action-next')->addExtraClass('btn-green'));
     $validator = new RequiredFields('FirstName', 'Surname', 'Address1', 'City', 'PostCode', 'Country', 'Email');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:14,代码来源:BillingDetailsForm.php

示例3: AddLink

 /**
  * Return a URL that allows this code to be added to a cart
  * automatically
  *
  * @return String
  */
 public function AddLink()
 {
     $link = Controller::join_links(Director::absoluteBaseURL(), ShoppingCart::config()->url_segment, "usediscount", $this->Code);
     return $link;
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-checkout,代码行数:11,代码来源:Discount.php

示例4: getCommerceCartEnabled

 /**
  * Checks to see if the shopping cart functionality is enabled
  *
  * @return Boolean
  */
 public function getCommerceCartEnabled()
 {
     return ShoppingCart::config()->enabled;
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:9,代码来源:Ext_Commerce_Controller.php

示例5: getBackURL

 public function getBackURL()
 {
     return Controller::join_links(BASE_URL, ShoppingCart::config()->url_segment);
 }
开发者ID:i-lateral,项目名称:silverstripe-checkout,代码行数:4,代码来源:BillingDetailsForm.php

示例6: AddItemForm

 public function AddItemForm()
 {
     if (ShoppingCart::config()->enabled) {
         $form = AddItemToCartForm::create($this, $this->dataRecord, "AddItemForm")->addExtraClass('forms')->addExtraClass('forms-columnar');
         $this->extend("updateAddItemForm", $form);
         return $form;
     } else {
         return false;
     }
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:10,代码来源:Catalogue_Controller.php


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