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


PHP ShopGroup::add方法代码示例

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


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

示例1: createShop

 public function createShop($shop_name)
 {
     // Create default group shop
     $shop_group = new ShopGroup();
     $shop_group->name = 'Default';
     $shop_group->active = true;
     if (!$shop_group->add()) {
         $this->setError($this->language->l('Cannot create group shop') . ' / ' . Db::getInstance()->getMsgError());
         return false;
     }
     // Create default shop
     $shop = new Shop();
     $shop->active = true;
     $shop->id_shop_group = $shop_group->id;
     $shop->id_category = 2;
     $shop->id_theme = 1;
     $shop->name = $shop_name;
     if (!$shop->add()) {
         $this->setError($this->language->l('Cannot create shop') . ' / ' . Db::getInstance()->getMsgError());
         return false;
     }
     Context::getContext()->shop = $shop;
     // Create default shop URL
     $shop_url = new ShopUrl();
     $shop_url->domain = Tools::getHttpHost();
     $shop_url->domain_ssl = Tools::getHttpHost();
     $shop_url->physical_uri = __PS_BASE_URI__;
     $shop_url->id_shop = $shop->id;
     $shop_url->main = true;
     $shop_url->active = true;
     if (!$shop_url->add()) {
         $this->setError($this->language->l('Cannot create shop URL') . ' / ' . Db::getInstance()->getMsgError());
         return false;
     }
     return true;
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:36,代码来源:install.php

示例2: create_group

 public static function create_group($name, $shareCustomers, $shareStock, $shareOrders, $active = true)
 {
     if (!Validate::isBool($shareCustomers)) {
         return false;
     }
     if (!Validate::isBool($shareStock)) {
         return false;
     }
     if (!Validate::isBool($shareOrders)) {
         return false;
     }
     if (!Validate::isBool($active)) {
         return false;
     }
     $shopGroup = new ShopGroup();
     $shopGroup->name = $name;
     $shopGroup->active = $active;
     $shopGroup->share_customer = $shareCustomers;
     $shopGroup->share_stock = $shareStock;
     $shopGroup->share_order = $shareOrders;
     // todo: echo shopgroupid
     if ($shopGroup->add()) {
         echo "Shop group {$name} successfully created\n";
         return true;
     } else {
         echo "Error, could not create shop group {$name}\n";
         return false;
     }
 }
开发者ID:rodrisan,项目名称:ps-cli,代码行数:29,代码来源:multistore.php


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