Jump to content

[8] Array to string conversion: I can only add product name.


lupradoa

Recommended Posts

Hi,

I'm modifying the default template in order to display some custom fields needed for an online bookshop.

 

I've done this so far: 

  • the 'description_short' field has been renamed as "autor"
  • 'upc' is now year of publication
  • 'ean13' is the edtion
  • new custom field: 'colación / tapa', is the type of cover

 

Files modified:

 

Product.php

** @var string Colacion */
    public $tapa;
	
...
/* Classic fields */
'ean13' =>                        array('type' => self::TYPE_STRING,  'size' => 13),
            'upc' =>                        array('type' => self::TYPE_STRING,  'size' => 12),
...
/* Lang fields */			 'tapa' =>  						array('type' =>self::TYPE_STRING, 'lang'=>true, 'size' => 128),

informations.tpl

<!-- ******************** add author field description_short -> author***************-->

	<div class="form-group">
		<div class="col-lg-1"><span class="pull-right">{include file="controllers/products/multishop/checkbox.tpl" field="description_short" type="tinymce" multilang="true"}</span></div>
		<label class="control-label col-lg-2" for="description_short_{$id_lang}">
			<span class="label-tooltip" data-toggle="tooltip" title="{l s='Appears in the product list(s), and at the top of the product page.'}">
				{l s='Autor'}
			</span>
		</label>
		<div class="col-lg-9">
			{include
				file="controllers/products/textarea_lang.tpl"
				languages=$languages
				input_name='description_short'
				class="autoload_rte"
				input_value=$product->description_short
				max=$PS_PRODUCT_SHORT_DESC_LIMIT}
		</div>
	</div>
	
	<!--******************** add author field end ***************->

******************** add ISBN field  ***************-->

	<div class="form-group">
		<label class="control-label col-lg-3" for="reference">
			<span class="label-tooltip" data-toggle="tooltip"
			title="{l s='Your internal reference code for this product.'} {l s='Allowed special characters:'} .-_#\">
				<!--{$bullet_common_field} {l s='Reference code'}-->
				{$bullet_common_field} {l s='ISBN'}
			</span>
		</label>
		<div class="col-lg-5">
			<input type="text" id="reference" name="reference" value="{$product->reference|htmlentitiesUTF8}" />
		</div>
	</div>


<!-- ************ COLACION # EDICION # AÑO ***************-->
<div class="form-group">
		<label class="control-label col-lg-3" for="reference">
			<span class="label-tooltip" data-toggle="tooltip"
			title="{l s='Tipo de edicion y paginas.'} {l s='Allowed special characters:'} |.-_#\/">
				{$bullet_common_field} {l s='Colación'}
			</span>
		</label>
		<div class="col-lg-5">
			<!--<input type="text" id="tapa" name="tapa" value="{$product->tapa|htmlentitiesUTF8}" />-->
            {include file="controllers/products/input_text_lang.tpl"
				languages=$languages
				input_class="{$class_input_ajax}{if !$product->id || Configuration::get('PS_FORCE_FRIENDLY_PRODUCT')}copy2friendlyUrl{/if} updateCurrentText"
				input_value=$product->tapa
				input_name="tapa"
				required=false
			}
            
		</div>
	</div>
    
    <div class="form-group">
		<label class="control-label col-lg-3" for="ean13">
			<span class="label-tooltip" data-toggle="tooltip"
				title="{l s='Número de edición.'}">
				{$bullet_common_field} {l s='Edicion'}
			</span>
		</label>
		<div class="col-lg-3">
			<input maxlength="13" type="text" id="ean13" name="ean13" value="{$product->ean13|htmlentitiesUTF8}" />
		</div>
	</div>

	<div class="form-group">
		<label class="control-label col-lg-3" for="upc">
			<span class="label-tooltip" data-toggle="tooltip"
				title="{l s='Año de edcion'}">
				{$bullet_common_field} {l s='Año'}
			</span>
		</label>
		<div class="col-lg-3">
			<input maxlength="6" type="text" id="upc" name="upc" value="{$product->upc|escape:'html':'UTF-8'}" />
		</div>
	</div>
<!-- ************ end of COLACION # EDICION # AÑO ***************-->

product.tpl

<p id="product_reference"{if empty($product->reference) || !$product->reference} style="display: none;"{/if}>
			<!--<label>{l s='Reference:'} </label>-->
				<label>{l s='ISBN:'} </label>				
                <span class="editable" itemprop="sku"{if !empty($product->reference) && $product->reference} content="{$product->reference}"{/if}>{if !isset($groups)}{$product->reference|escape:'html':'UTF-8'}{/if}</span>
			</p>

...

 <p id="product_reference">
				<label>{l s='Colación:'} </label>				
                <span class="editable" itemprop="sku" content="{$product->tapa}">{$product->tapa|escape:'html':'UTF-8'}</span>
			</p>
            <p id="product_reference">
				<label>{l s='Edición:'} </label>				
                <span class="editable" itemprop="sku" content="{$product->edc}">{$product->ean13|escape:'html':'UTF-8'} | {$product->upc|escape:'html':'UTF-8'}</span>
			</p>

When I add a new product or I try to modify one of the already added, I've got two errors: 

 

 

  1. Notice on line 258 in file /..../httpdocs/libros/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code

    [8] Array to string conversion

  2. Any of the tabs (price, quantity... ) shows nothing but a blank screen // Cualquiera de las otras pestañas que hay para editar o crear un producto, me lleva a un espacio en blanco

  3. post-1084449-0-01555000-1472818328_thumb.jpg

Any suggestion?

Luis.

Edited by lupradoa (see edit history)
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...