Adding product type in prestashop add product page

你。 提交于 2019-12-24 10:38:57

问题


Iam new to prestashop ,iam trying to add new product type in addition to Standard product,Virtual product ,Pack of existing products

Added this in informations.tpl file

<
div class="radio">
                <label for="digital_product">
                    <input type="radio" name="type_product" id="digital_product" {if $is_in_pack}disabled="disabled"{/if} value="{Product::PTYPE_DIGITAL}" {if $product_type == Product::PTYPE_DIGITAL}checked="checked"{/if} >
                    {l s='Digital product (services, booking, downloadable products, etc.)'}</label>
            </div>

i want to save this in new column is_digital in ps_product table.iam struck here.Please help. Is there any any documentaion for full working flow of all classes and functions of prestashop?


回答1:


Changing the core workings of PrestaShop is a HUGE undertaking. You should and must use a module for cases like this.

  1. Go to Hook.php and find exec() function. Use error_log($hook_name) to find out which hook are availble when a specific action is performed. For example, when you open product edit page, they may be FormModifier hook which you could use to add a radio box for a new product type. But that is just "cosmetics" of adding an new type.
  2. You should create a module for modifying PrestaShop. First, try to find if there is a hook available to modify what you need. If there isn't, you will need to override the actual class/controller. Overrding is easy, but generally not recommended. Create copies of class/controller files in your module folder: modules/yourmodule/override/controller/admin/AdminProductCotnroller.php and only leave functions which you are overrding. Also, try to make if conditional: if ($iCanModify) { // Modify} else { return parent::method(); }
  3. Track down a product type constant, variable or string (Product::TYPE_STANDARD?) everywhere where it occurs in PS files. You will need to modify/add logic to these places to make you new tyoe work.


来源:https://stackoverflow.com/questions/26946382/adding-product-type-in-prestashop-add-product-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!