emporio Posted June 8, 2015 Share Posted June 8, 2015 Hello to everyone, I'm new on Prestashop, and thanks all for the support and in advance anyone who wants to help me. I have installed Prestashop 1.6.0.14 on local to my PC with xampp, I want change the item condition from the defalut: new, used, refurbished to: new, like new (overwriting “used”), very good (overwriting “refurbished”), good (new condition), acceptable (new condition) I have modify: ps_product, ps_product_shop, informations.tpl, Product.php, product.tpl, and I have add the new condition in menu localization / translation as described here: http://www.prestamod.fr/blog/2014/11/ajouter-des-etats-aux-produits-dans-le-module-ebay/ everything works well and the categories are imported correctly in prestashop. Only when I modify the EbayCategoryConditionConfiguration.php I have problem. If I in EbayCategoryConditionConfiguration.php, overwriting the “used” and “refurbished” category with “like new” and “very good” everything works well, both the 2 categories are changed correctly in prestashop that on ebay, but when I add the 2 new condition “good” and “acceptable” to EbayCategoryConditionConfiguration.php, I have problem and I can not log in to the BO. Where I have that I'm wrong? someone can kindly help me? I need to divide my products in these 5 categories Link to comment Share on other sites More sharing options...
emporio Posted June 9, 2015 Author Share Posted June 9, 2015 no one who can kindly respond? Link to comment Share on other sites More sharing options...
emporio Posted June 10, 2015 Author Share Posted June 10, 2015 (edited) I re-reading the topic, I did not write it clearly as described here:http://www.prestamod.fr/blog/2014/11/ajouter-des-etats-aux-produits-dans-le-module-ebay/ I have modified ps_product and ps_product_shop via phpMyAdmin in value condition: from: 'new','used','refurbished' to: 'new','like new','very good','good','acceptable' in informations.tpl from: <div class="col-lg-3"> <select name="condition" id="condition"> <option value="new" {if $product->condition == 'new'}selected="selected"{/if} >{l s='New'}</option> <option value="used" {if $product->condition == 'used'}selected="selected"{/if} >{l s='Used'}</option> <option value="refurbished" {if $product->condition == 'refurbished'}selected="selected"{/if}>{l s='Refurbished'}</option> </select> to: <div class="col-lg-3"> <select name="condition" id="condition"> <option value="new" {if $product->condition == 'new'}selected="selected"{/if} >{l s='New'}</option> <option value="like new" {if $product->condition == 'like new'}selected="selected"{/if} >{l s='Like new'}</option> <option value="very good" {if $product->condition == 'very good'}selected="selected"{/if}>{l s='Very good'}</option> <option value="good" {if $product->condition == 'good'}selected="selected"{/if}>{l s='Good'}</option> <option value="acceptable" {if $product->condition == 'acceptable'}selected="selected"{/if}>{l s='Acceptable'}</option> </select> in Product.php from: 'condition' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isGenericName', 'values' => array('new', 'used', 'refurbished'), 'default' => 'new'), to: 'condition' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isGenericName', 'values' => array('new', 'like new', 'very good', 'good', 'acceptable'), 'default' => 'new'), my product.tpl is a little different from that http://www.prestamod.fr/blog/2014/11/ajouter-des-etats-aux-produits-dans-le-module-ebay/ I have modified from: {capture name=condition} {if $product->condition == 'new'}{l s='New'} {elseif $product->condition == 'used'}{l s='Used'} {elseif $product->condition == 'refurbished'}{l s='Refurbished'} {/if} {/capture} in: {if !$product->is_virtual && $product->condition} <p id="product_condition"> <label>{l s='Condition:'} </label> {if $product->condition == 'new'} <link itemprop="itemCondition" href="http://schema.org/NewCondition"/> <span class="editable">{l s='New product'}</span> {elseif $product->condition == 'like new'} <link itemprop="itemCondition" href="http://schema.org/UsedCondition"/> <span class="editable">{l s='Like new'}</span> {elseif $product->condition == 'very good'} <link itemprop="itemCondition" href="http://schema.org/RefurbishedCondition"/> <span class="editable">{l s='Very good'}</span> {elseif $product->condition == 'good'} <link itemprop="itemCondition" href="http://schema.org/RefurbishedCondition"/> <span class="editable">{l s='Good'}</span> {elseif $product->condition == 'acceptable'} <link itemprop="itemCondition" href="http://schema.org/RefurbishedCondition"/> <span class="editable">{l s='Acceptable'}</span> {/if} Then I have add and translate the new condition, new, like new, very good, good, acceptable, in menu localization / translation When then i modify the EbayCategoryConditionConfiguration.php from: class EbayCategoryConditionConfiguration { const PS_CONDITION_NEW = 1; const PS_CONDITION_USED = 2; const PS_CONDITION_REFURBISHED = 3; public static function getPSConditions($condition_type = null) { $condition_types = array( EbayCategoryConditionConfiguration::PS_CONDITION_NEW => 'new', EbayCategoryConditionConfiguration::PS_CONDITION_USED => 'used', EbayCategoryConditionConfiguration::PS_CONDITION_REFURBISHED => 'refurbished' ); to: class EbayCategoryConditionConfiguration { const PS_CONDITION_NEW = 1; const PS_CONDITION_LIKE_NEW = 2; const PS_CONDITION_VERY_GOOD = 3; public static function getPSConditions($condition_type = null) { $condition_types = array( EbayCategoryConditionConfiguration::PS_CONDITION_NEW => 'new', EbayCategoryConditionConfiguration::PS_CONDITION_LIKE_NEW => 'like new', EbayCategoryConditionConfiguration::PS_CONDITION_VERY_GOOD => 'very good' ); everything works well and the categories are imported correctly in prestashop. but when I add in EbayCategoryConditionConfiguration.php the new 2 condition: from: class EbayCategoryConditionConfiguration { const PS_CONDITION_NEW = 1; const PS_CONDITION_USED = 2; const PS_CONDITION_REFURBISHED = 3; public static function getPSConditions($condition_type = null) { $condition_types = array( EbayCategoryConditionConfiguration::PS_CONDITION_NEW => 'new', EbayCategoryConditionConfiguration::PS_CONDITION_USED => 'used', EbayCategoryConditionConfiguration::PS_CONDITION_REFURBISHED => 'refurbished' ); to: class EbayCategoryConditionConfiguration { const PS_CONDITION_NEW = 1; const PS_CONDITION_LIKE_NEW = 2; const PS_CONDITION_VERY_GOOD = 3; const PS_CONDITION_GOOD = 4; const PS_CONDITION_ACCEPTABLE = 5; public static function getPSConditions($condition_type = null) { $condition_types = array( EbayCategoryConditionConfiguration::PS_CONDITION_NEW => 'new', EbayCategoryConditionConfiguration::PS_CONDITION_LIKE_NEW => 'like new', EbayCategoryConditionConfiguration::PS_CONDITION_VERY_GOOD => 'very good' EbayCategoryConditionConfiguration::PS_CONDITION_GOOD => 'good' EbayCategoryConditionConfiguration::PS_CONDITION_ACCEPTABLE => 'acceptable' ); I can not access to the BO, If i modify again the EbayCategoryConditionConfiguration.php without adding the two new conditions, all comes back to work correctly and I can again access to the BO. I think that is the EbayCategoryConditionConfiguration.php to not be configured properly this is the remaining part of EbayCategoryConditionConfiguration.php: class EbayCategoryConditionConfiguration { const PS_CONDITION_NEW = 1; const PS_CONDITION_LIKE_NEW = 2; const PS_CONDITION_VERY_GOOD = 3; const PS_CONDITION_GOOD = 4; const PS_CONDITION_ACCEPTABLE = 5; public static function getPSConditions($condition_type = null) { $condition_types = array( EbayCategoryConditionConfiguration::PS_CONDITION_NEW => 'new', EbayCategoryConditionConfiguration::PS_CONDITION_LIKE_NEW => 'like new', EbayCategoryConditionConfiguration::PS_CONDITION_VERY_GOOD => 'very good' EbayCategoryConditionConfiguration::PS_CONDITION_GOOD => 'good' EbayCategoryConditionConfiguration::PS_CONDITION_ACCEPTABLE => 'acceptable' ); if ($condition_type) return $condition_types[$condition_type]; return $condition_types; } public static function replace($data) { $to_insert = array(); foreach ($data as $key => $value) $to_insert[bqSQL($key)] = pSQL($value); if (version_compare(_PS_VERSION_, '1.5', '>')) Db::getInstance()->insert('ebay_category_condition_configuration', $to_insert, false, false, Db::REPLACE); else Db::getInstance()->execute('REPLACE INTO `'._DB_PREFIX_.'ebay_category_condition_configuration` (`'.implode('` , `', array_keys($to_insert)).'`) VALUES (\''.implode('\', \'', $to_insert).'\')'); } } Thanks in advance anyone who wants to help me Edited June 10, 2015 by emporio (see edit history) Link to comment Share on other sites More sharing options...
emporio Posted June 10, 2015 Author Share Posted June 10, 2015 I tried to change as follows, adding only the fields after class EbayCategoryConditionConfiguration, and without adding anything after public static function getPSConditions, and thus I can access to BO, adding a single value after public static function getPSConditions I no longer access the BO class EbayCategoryConditionConfiguration { const PS_CONDITION_NEW = 1; const PS_CONDITION_LIKE_NEW = 2; const PS_CONDITION_VERY_GOOD = 3; const PS_CONDITION_GOOD = 4; const PS_CONDITION_ACCEPTABLE = 5; public static function getPSConditions($condition_type = null) { $condition_types = array( EbayCategoryConditionConfiguration::PS_CONDITION_NEW => 'new', EbayCategoryConditionConfiguration::PS_CONDITION_LIKE_NEW => 'like new', EbayCategoryConditionConfiguration::PS_CONDITION_VERY_GOOD => 'very good' ); if ($condition_type) return $condition_types[$condition_type]; return $condition_types; } public static function replace($data) { $to_insert = array(); foreach ($data as $key => $value) $to_insert[bqSQL($key)] = pSQL($value); if (version_compare(_PS_VERSION_, '1.5', '>')) Db::getInstance()->insert('ebay_category_condition_configuration', $to_insert, false, false, Db::REPLACE); else Db::getInstance()->execute('REPLACE INTO `'._DB_PREFIX_.'ebay_category_condition_configuration` (`'.implode('` , `', array_keys($to_insert)).'`) VALUES (\''.implode('\', \'', $to_insert).'\')'); } } Link to comment Share on other sites More sharing options...
Involic Posted June 10, 2015 Share Posted June 10, 2015 I'm not fully sure but look like you forgot add comma after each of new items. So this not correct: $condition_types = array( EbayCategoryConditionConfiguration::PS_CONDITION_NEW => 'new', EbayCategoryConditionConfiguration::PS_CONDITION_LIKE_NEW => 'like new', EbayCategoryConditionConfiguration::PS_CONDITION_VERY_GOOD => 'very good' EbayCategoryConditionConfiguration::PS_CONDITION_GOOD => 'good' EbayCategoryConditionConfiguration::PS_CONDITION_ACCEPTABLE => 'acceptable' ); Correct is $condition_types = array( EbayCategoryConditionConfiguration::PS_CONDITION_NEW => 'new', EbayCategoryConditionConfiguration::PS_CONDITION_LIKE_NEW => 'like new', EbayCategoryConditionConfiguration::PS_CONDITION_VERY_GOOD => 'very good', EbayCategoryConditionConfiguration::PS_CONDITION_GOOD => 'good', EbayCategoryConditionConfiguration::PS_CONDITION_ACCEPTABLE => 'acceptable', ); There manual of php regarding arrays http://php.net/manual/en/language.types.array.php Hope this information help you. Also we can suggest try to verify your file that it have correct php syntax. There couple of free validators from google http://phpcodechecker.com/ http://www.piliapp.com/php-syntax-check/ http://www.icosaedro.it/phplint/phplint-on-line.html Not fully sure that it's work but you can try. Link to comment Share on other sites More sharing options...
emporio Posted June 11, 2015 Author Share Posted June 11, 2015 involic you are magic!!! I have correct adding the comma and all work perfect, I did not know where to look, thank you very very much!!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now