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


PHP ShoppingCart::set_country方法代码示例

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


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

示例1: __construct

 function __construct($controller, $name)
 {
     Requirements::javascript(ECOMMERCE_DIR . '/javascript/OrderFormWithoutShippingAddress.js');
     parent::__construct($controller, $name);
     //stop people adding different shipping address
     $this->unsetActionByName("action_useDifferentShippingAddress");
     $this->unsetActionByName("useDifferentShippingAddress");
     $member = Member::currentMember();
     if (!$member || !$member->ID || $member->Password == '') {
         $this->fields->addFieldToTab("", new LiteralField('MemberInfoAlso', '<p class="message good LoginCallToAction">' . self::get_login_invite_alternative_text() . '</p>', $this), "FirstName");
         //improve password field TEMPORARY HACK!
         //$passwordField = new OptionalConfirmedPasswordField('Password', 'Password', '', null, true);
         //$passwordField->minLength = 6;
         //$passwordField->showOnClickTitle = "add password now";
         //$this->fields->replaceField("Password", $passwordField);
         Requirements::javascript(ECOMMERCE_DIR . '/javascript/OptionalConfirmedPasswordField.js');
         Requirements::block(SAPPHIRE_DIR . '/javascript/ConfirmedPasswordField.js');
     }
     $this->fields->removeFieldFromTab("RightOrder", "MemberInfo");
     //add extra fields
     foreach (self::$extra_fields as $fieldCombo) {
         $fieldCombo["FieldObject"]->setForm($this);
         $this->fields->addFieldToTab($fieldCombo["TabName"], $fieldCombo["FieldObject"]);
     }
     //replace field for address
     foreach ($this->fields->dataFields() as $i => $child) {
         if (is_object($child)) {
             $name = $child->Name();
             switch ($name) {
                 case "Membership Details":
                     $child->setTitle('Retain Personal Details with Password');
                     break;
                 case "Address":
                     $child->setTitle('Street Address');
                     break;
                 case "AddressLine2":
                     $child->setRightTitle('<a href="' . self::$postal_code_url . '" id="OrderFormWithoutShippingAddressPostalCodeLink">' . self::$postal_code_label . '</a>');
                     $child->setTitle('Postal Code');
                     break;
                 case "Country":
                     if (self::$fixed_country_code) {
                         $child->setValue(self::$fixed_country_code);
                         ShoppingCart::set_country(self::$fixed_country_code);
                     }
                     break;
                 default:
                     break;
             }
         }
     }
     $this->fields->addFieldToTab("", new TextareaField('CustomerOrderNote', 'Note / Question', 7, 30, null, $this));
     $data = $this->getData();
     $this->loadDataFrom($data);
 }
开发者ID:riddler7,项目名称:silverstripe-ecommerce,代码行数:54,代码来源:OrderFormWithoutShippingAddress.php

示例2: setcountry

 /**
  *  Change country action
  * */
 function setcountry($request)
 {
     $countryCode = $request->param('ID');
     if ($countryCode && strlen($countryCode) < 4) {
         //to do: check if country exists
         ShoppingCart::set_country($countryCode);
         //return _t("ShoppingCart.COUNTRYUPDATED", "Country updated.");
         return self::json_code();
     }
     return _t("ShoppingCart.COUNTRYCOULDNOTBEUPDATED", "Country not be updated.");
 }
开发者ID:riddler7,项目名称:silverstripe-ecommerce,代码行数:14,代码来源:ShoppingCart.php

示例3: setcountry

 /**
  * Ajax method to set a country
  */
 function setcountry()
 {
     $country = $this->urlParams['ID'];
     if (isset($country)) {
         ShoppingCart::set_country($country);
         return self::json_code();
     }
 }
开发者ID:nicolaas,项目名称:silverstripe-ecommerce,代码行数:11,代码来源:ShoppingCart.php

示例4: updateShippingCountry

 function updateShippingCountry($data, $form, $request)
 {
     Session::set($this->FormName(), $data);
     ShoppingCart::set_country($data['Country']);
     if (Director::is_ajax()) {
         return "success";
     }
     Director::redirectBack();
 }
开发者ID:riddler7,项目名称:silverstripe-ecommerce,代码行数:9,代码来源:OrderForm.php


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