本文整理汇总了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);
}
}
示例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);
}
示例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;
}
示例4: getCommerceCartEnabled
/**
* Checks to see if the shopping cart functionality is enabled
*
* @return Boolean
*/
public function getCommerceCartEnabled()
{
return ShoppingCart::config()->enabled;
}
示例5: getBackURL
public function getBackURL()
{
return Controller::join_links(BASE_URL, ShoppingCart::config()->url_segment);
}
示例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;
}
}