Пример #1
0
 public function view()
 {
     $this->set("taxRates", StoreTax::getTaxRates());
     $this->set("taxClasses", StoreTaxClass::getTaxClasses());
 }
Пример #2
0
 public function validate($args)
 {
     $e = Loader::helper('validation/error');
     if ($args['symbol'] == "") {
         $e->add(t('You must set a currency symbol'));
     }
     if ($args['taxEnabled'] == 'yes') {
         if (!is_numeric(trim($args['taxRate']))) {
             $e->add(t('Tax Rate must be set, and a number'));
         }
     }
     if ($args['shippingEnabled'] == 'yes') {
         if (!is_numeric(trim($args['shippingBasePrice']))) {
             $e->add(t('Shipping Base Rate must be set, and a number'));
         }
         if (!is_numeric(trim($args['shippingItemPrice']))) {
             $e->add(t('Shipping Base Rate must be set, and a number (even if just zero)'));
         }
     }
     $paymentMethodsEnabled = 0;
     foreach ($args['paymentMethodEnabled'] as $method) {
         if ($method == 1) {
             $paymentMethodsEnabled++;
         }
     }
     if ($paymentMethodsEnabled == 0) {
         $e->add(t('At least one payment method must be enabled'));
     }
     foreach ($args['paymentMethodEnabled'] as $pmID => $value) {
         $pm = StorePaymentMethod::getByID($pmID);
         $controller = $pm->getMethodController();
         $e = $controller->validate($args, $e);
     }
     if (!isset($args['osName'])) {
         $e->add(t('You must have at least one Order Status.'));
     }
     //before changing tax settings to "Extract", make sure there's only one rate per class
     $taxClasses = StoreTaxClass::getTaxClasses();
     foreach ($taxClasses as $taxClass) {
         $taxClassRates = $taxClass->getTaxClassRates();
         if (count($taxClassRates) > 1) {
             $e->add(t("The %s Tax Class can't contain more than 1 Tax Rate if you change how the taxes are calculated", $taxClass->getTaxClassName()));
         }
     }
     return $e;
 }
Пример #3
0
 public function loadFormAssets()
 {
     $this->requireAsset('redactor');
     $this->requireAsset('core/file-manager');
     $this->requireAsset('core/sitemap');
     $this->set('fp', FilePermissions::getGlobal());
     $this->set('tp', new TaskPermission());
     $this->set('al', Core::make('helper/concrete/asset_library'));
     $this->addHeaderItem('<style type="text/css">.redactor_editor{padding:20px}</style>');
     $this->requireAsset('css', 'vividStoreDashboard');
     $this->requireAsset('javascript', 'vividStoreFunctions');
     $attrList = StoreProductKey::getList();
     $this->set('attribs', $attrList);
     $pageType = PageType::getByHandle("store_product");
     $pageTemplates = $pageType->getPageTypePageTemplateObjects();
     $templates = array();
     foreach ($pageTemplates as $pt) {
         $templates[$pt->getPageTemplateID()] = $pt->getPageTemplateName();
     }
     $this->set('pageTemplates', $templates);
     $taxClasses = array();
     foreach (StoreTaxClass::getTaxClasses() as $taxClass) {
         $taxClasses[$taxClass->getTaxClassID()] = $taxClass->getTaxClassName();
     }
     $this->set('taxClasses', $taxClasses);
 }