當前位置: 首頁>>代碼示例>>PHP>>正文


PHP StockAvailable::copyStockAvailableFromShopToShop方法代碼示例

本文整理匯總了PHP中StockAvailable::copyStockAvailableFromShopToShop方法的典型用法代碼示例。如果您正苦於以下問題:PHP StockAvailable::copyStockAvailableFromShopToShop方法的具體用法?PHP StockAvailable::copyStockAvailableFromShopToShop怎麽用?PHP StockAvailable::copyStockAvailableFromShopToShop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在StockAvailable的用法示例。


在下文中一共展示了StockAvailable::copyStockAvailableFromShopToShop方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: processAdd

 /**
  * Object creation
  */
 public function processAdd()
 {
     if (!Tools::getValue('categoryBox') || !in_array(Tools::getValue('id_category'), Tools::getValue('categoryBox'))) {
         $this->errors[] = $this->l('You need to select at least the root category.');
     }
     if (Tools::isSubmit('id_category_default')) {
         $_POST['id_category'] = (int) Tools::getValue('id_category_default');
     }
     /* Checking fields validity */
     $this->validateRules();
     if (!count($this->errors)) {
         $object = new $this->className();
         $this->copyFromPost($object, $this->table);
         $this->beforeAdd($object);
         if (!$object->add()) {
             $this->errors[] = Tools::displayError('An error occurred while creating an object.') . ' <b>' . $this->table . ' (' . Db::getInstance()->getMsgError() . ')</b>';
         } else {
             if (($_POST[$this->identifier] = $object->id) && $this->postImage($object->id) && !count($this->errors) && $this->_redirect) {
                 $parent_id = (int) Tools::getValue('id_parent', 1);
                 $this->afterAdd($object);
                 $this->updateAssoShop($object->id);
                 // Save and stay on same form
                 if (Tools::isSubmit('submitAdd' . $this->table . 'AndStay')) {
                     $this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=' . $object->id . '&conf=3&update' . $this->table . '&token=' . $this->token;
                 }
                 // Save and back to parent
                 if (Tools::isSubmit('submitAdd' . $this->table . 'AndBackToParent')) {
                     $this->redirect_after = self::$currentIndex . '&' . $this->identifier . '=' . $parent_id . '&conf=3&token=' . $this->token;
                 }
                 // Default behavior (save and back)
                 if (empty($this->redirect_after)) {
                     $this->redirect_after = self::$currentIndex . ($parent_id ? '&' . $this->identifier . '=' . $object->id : '') . '&conf=3&token=' . $this->token;
                 }
             }
         }
     }
     $this->errors = array_unique($this->errors);
     if (count($this->errors) > 0) {
         $this->display = 'add';
         return;
     }
     // specific import for stock
     if (isset($import_data['stock_available']) && isset($import_data['product']) && Tools::isSubmit('useImportData')) {
         $id_src_shop = (int) Tools::getValue('importFromShop');
         if ($object->getGroup()->share_stock == false) {
             StockAvailable::copyStockAvailableFromShopToShop($id_src_shop, $object->id);
         }
     }
     $categories = Tools::getValue('categoryBox');
     array_unshift($categories, Configuration::get('PS_ROOT_CATEGORY'));
     Category::updateFromShop($categories, $object->id);
     Search::indexation(true);
     return $object;
 }
開發者ID:gks-stage,項目名稱:prestashop,代碼行數:57,代碼來源:AdminShopController.php


注:本文中的StockAvailable::copyStockAvailableFromShopToShop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。