Jump to content

Custom Product Field Returns array Instead of string


treyj45

Recommended Posts

I added a new field like so in product.php controller

 public $copyright_symbol;

And to the definition array.....

 'copyright_symbol' =>           array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),


I added a var_char 255 field in ps_product_lang

 

 

Informations.tpl I added...

	<div class="form-group">
		<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="copyright_symbol" type="default"}</span></div>
		<label class="control-label col-lg-2" for="copyright_symbol">
			{l s='Copyright Symbol'}
		<div class="col-lg-3">
			<select name="copyright_symbol" id="copyright_symbol">
				<option value="none" {if !isset($product->copyright_symbol) or $product->copyright_symbol == 'none'}selected="selected"{/if} >{l s='None'}</option>
				<option value="reg" {if $product->copyright_symbol == 'reg' or $product->copyright_symbol[1] == 'reg'}selected="selected"{/if} >{l s="Reg"}</option>
				<option value="trade" {if $product->copyright_symbol == 'trade' or $product->copyright_symbol[1] == 'trade'}selected="selected"{/if} >{l s="Trade"}</option>
				
			</select>
		</div>
	</div>

Why does {$product->copyright_symbol} come back as an array?  Why do I need to put $product->copyright_symbol[1] to get my value?

 

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...