outlet.ee Posted May 28, 2010 Share Posted May 28, 2010 I'd like to have the supplier reference to appear as a link, so I need to import the field values as but these are currently all invalid characters. I can import them via phpmyadmin but then I am not able to update the product anymore.Where could I change this? Link to comment Share on other sites More sharing options...
rocky Posted June 5, 2010 Share Posted June 5, 2010 It is the following function on line 411 of classes/Validate.php (in PrestaShop v1.3) that validates the reference fields: static public function isReference($reference) { return preg_match('/^[^<>;={}]*$/ui', $reference); } Remove the characters from there that you want to include in the reference field. Link to comment Share on other sites More sharing options...
outlet.ee Posted June 5, 2010 Author Share Posted June 5, 2010 Thank you!The reference is fine now, but how to do the same for supplie reference? Link to comment Share on other sites More sharing options...
rocky Posted June 5, 2010 Share Posted June 5, 2010 That change should affect the supplier reference too, since they both use the "isReference" validator. Link to comment Share on other sites More sharing options...
outlet.ee Posted June 6, 2010 Author Share Posted June 6, 2010 Now there is another problem - it strips the html code, leaving just the text between the tags (I insert the value as'ABC', it returns just plain ABC). Where could I change that? Link to comment Share on other sites More sharing options...
rocky Posted June 7, 2010 Share Posted June 7, 2010 I did a search for strip_tags and safeOutput, which both strip HTML tags, but I can't find where they are being applied to the reference field. Link to comment Share on other sites More sharing options...
outlet.ee Posted June 9, 2010 Author Share Posted June 9, 2010 It is pSQL($supplier_reference) in classes/Product.php, strip-tags for pSQL comes from classes/db.php, so I just removed the pSQL and leaving it just ($supplier_reference) and it works. Or will it break something else now? Link to comment Share on other sites More sharing options...
rocky Posted June 9, 2010 Share Posted June 9, 2010 No, that should work. Link to comment Share on other sites More sharing options...
outlet.ee Posted June 19, 2010 Author Share Posted June 19, 2010 Now there is the same thing with importing: it says # (ID 2922) cannot be saved# You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'http://www...... at the supplier reference field. What is it that prevents special characters to be imported? Link to comment Share on other sites More sharing options...
rocky Posted June 19, 2010 Share Posted June 19, 2010 I'm not sure what is causing that error. Are you importing attributes? The only thing I could find was the following on line 703 of Product.php in the addProductAttribute function: 'weight' => ($weight ? floatval($weight) : 0), 'reference' => pSQL($reference), 'supplier_reference' => pSQL($supplier_reference), which in your case should be: 'weight' => ($weight ? floatval($weight) : 0), 'reference' => pSQL($reference, true), 'supplier_reference' => pSQL($supplier_reference, true), I also found the following on lines 417-418 in the getByReference function that you'll need to comment out: if (!Validate::isReference($reference)) die(Tools::displayError()); 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