Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • Catalog
  • CatalogAdmin
  • CatalogBaseFiltersExtension
  • CatalogCMSActionDecorator
  • CatalogPrice
  • CatalogSiteConfig
  • CMSSiteTreeFilter_Catalog
  • Orders1CExchangeSiteConfig
  • PaymentType
  • Product
  • ProductSearchPage
  • SimpleOrderButton
  • SimpleOrderData
  • SimpleOrderPage
  • StartCatalog
  • VirtualProduct

Interfaces

  • OrderButtonInterface
 1 <?php
 2 
 3 /**
 4  * Кнопка заказать, если не используется модуль cart
 5  *
 6  * @package Catalog
 7  * @author inxo, dvp
 8  */
 9 class SimpleOrderButton extends ViewableData implements OrderButtonInterface {
10     
11     private $product = 0;
12 
13     function __construct($product) {
14         parent::__construct();
15         $this->product = $product;
16     }
17 
18     /**
19      * Показывает кнопку для заказа товара
20      * 
21      * @param bool $withNum  - флаг показывать ли поле для ввода кол-ва товаров
22      * 
23      * @return Form
24      */
25     public function Show($withNum = false) {
26         $fields = new FieldSet();
27         $fields->push(new HiddenField('itemId', '', $this->product));
28         if ($withNum) {
29             $fields->push($f = new NumericField('Num', '', 1));
30             $f->addExtraClass('OrderNumField');
31             $f->addExtraClass('AddProductNum');
32             $f->addExtraAttribute('title', _t('SimpleOrderButton.OrderNum', 'Product count to add...'));
33         }
34         $actions = new FieldSet($a = new FormAction("checkout", _t('SimpleOrderButton.AddToCart', 'Checkout')));
35         $a->addExtraClass('AddProductAction');
36 
37         $form = new Form(SimpleOrderPage_Controller::get_instance(), "checkout", $fields, $actions);
38 
39         $form->setTemplate('SimpleOrderButton');
40         $form->setHTMLID('AddProductForm_'. $this->product);
41         $form->addExtraClass('AddProductForm');
42         $form->getValidator()->setJavascriptValidationHandler('none');
43         $form->disableSecurityToken();
44         $form->setFormMethod('GET');
45         return $form;
46     }
47 
48     /**
49      * Показывает кнопку для заказа 1 товара
50      * 
51      * @return Form
52      */
53     public function One() {
54         return $this->Show();
55     }
56 
57     /**
58      * Показывает кнопку для заказа товара с полем кол-ва
59      * 
60      * @return Form
61      */
62     public function WithNum() {
63         return $this->Show(true);
64     }
65 
66     /**
67      * Отображение кнопки в шаблонах "по-умолчанию"
68      * 
69      * @return string
70      */
71     public function forTemplate() {
72         return $this->One()->forTemplate();
73     }
74 }
75 
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0