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?
Changing the core workings of PrestaShop is a HUGE undertaking. You should and must use a module for cases like this.
- 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.
- 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(); }
- 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.