Jump to content

Error when I add new field to product creation in BackEnd---NEW FIELD CONDITION


Recommended Posts


I tried to add a new field to my product creation and the result is that I can´t save the product and have the next issues:

Este campo link_rewrite se requiere por lo menos en Español (Spanish).


I make the next changes:


1. Add create new field in ps_product table.



2. Add create new field in ps_product_shop table.




3. Modify core files in classes/product.php



/** @var enum Product condition (brand, official store, store, professional seller, private seller) */

public $seller_type;


'seller_type' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isGenericName', 'values' => array('brand', 'official store', 'store', 'professional seller', 'private seller' ), 'default' => 'brand'),


4. Modify product edit .tpl file located in this path: 



<div class="form-group">
<label class="control-label col-lg-3" for="seller_type">
{include file="controllers/products/multishop/checkbox.tpl" field="seller_type" type="default"}
{l s='Seller type'}
<div class="col-lg-3">
<select name="seller_type" id="seller_type">
<option value="brand" {if $product->seller_type == 'brand'}selected="selected"{/if} >{l s='Brand'}</option>
<option value="official store" {if $product->seller_type == 'official store'}selected="selected"{/if} >{l s='Official store'}</option>
<option value="store" {if $product->seller_type == 'store'}selected="selected"{/if}>{l s='Store'}</option>
                        <option value="professional seller" {if $product->seller_type == 'professional seller'}selected="selected"{/if} >{l s='Professional seller'}</option>
<option value="private seller" {if $product->seller_type == 'private seller'}selected="selected"{/if} >{l s='Private seller'}</option>



5. Finally modify the THEME product.tpl (to show the result on my shop)


 {capture name=seller_type}

{if $product->seller_type == 'brand'}{l s='Brand'}
{elseif $product->seller_type == 'official store'}{l s='Official store'}
{elseif $product->seller_type == 'store'}{l s='Store'}
                {elseif $product->seller_type == 'professional seller'}{l s='Professional seller'}
                {elseif $product->seller_type == 'private seller'}{l s='Private seller'}
<p id="product_condition"{if !$product->seller_type} style="display: none;"{/if}>
<label>{l s='Seller type'}: </label>
<span class="editable" itemprop="seller_type">{$smarty.capture.seller_type}</span>
Really need your help with this.
Thank you,



Link to comment
Share on other sites

Hello Vekia,

I really appreciate your quick response.


you had the same issue before you modified the controllers and classes?




Before I do that I make the same process adding new fields to product "condition" and everithing worked fine. But I´m not sure if I add the ps_product table and ps_product_shop table correctly for seller_type field.


Thank you,


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...