You are here:  » dots removed in product name

Support Forum



dots removed in product name

Submitted by koek on Thu, 2009-07-30 14:26 in

Hi

on import dots "." in product names get removed. But I need them.

Where in the code can I change this behaviour?

Submitted by support on Thu, 2009-07-30 14:33

Hi,

dots are removed as part of the "normalisation" (making everything safe); however they are one of the safer characters so if you want to enable dots it should be OK, but after having done so check through all the functionality of your site in case of any side effects.

To permit dots, look for the following code around about line 159 of includes/admin.php

    $record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]]);

...and REPLACE this with:

    $record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]],".");

The optional second parameter to tapestry_normalise() contains a string of characters to allow, overriding the default rules used by the the normalise function.

Don't forget to re-import any affected feeds for the changes to take effect.

Cheers,
David.

Submitted by koek on Thu, 2009-07-30 15:16

Thanks for the quick answer.

Submitted by chodges84 on Fri, 2009-07-31 17:57

Hi David,

I am having a problem regarding this.

I would like to use Hyphens and ideally parentheses in my product names. e.g. a product called

Fifa 2020 - Beckhams Revenge (Wii)

Gets parsed as Fifa 2020 Beckhams Revenge Wii

I would just like to neaten things up a bit. I tried what you suggested above but in the admin panel I get 'Invalid character' when I add a new product in the Product mapping with a hyphen; I haven't tried brackets yet.

I understand the problems they can cause, but was wondering if it was possible to try?

I am using htaccess to rewrite my URL's as well.

Submitted by support on Fri, 2009-07-31 18:05

Hi,

With hyphens and other symbols, it sounds like the separate name_display field modification might be more appropriate. What this does is maintain a second product name field in the database that is used for the page title etc., whilst the normalised version is used for the URL.

Full details in this comment:

http://www.pricetapestry.com/node/2634#comment-10570

If you're not sure about any of the modifications, email me the relevant files and I'll make the changes for you...

Cheers,
David.

Submitted by chodges84 on Sat, 2009-08-01 17:35

Hi David,

Many thanks for getting back so quickly. I have followed the instructions in the other thread and I have hit a couple of snags.

1. When I try to add a product on the product mapping with a hyphen on brackets - still get a message about invalid characters.
2. When I now import a feed I end up with no products in the database.

Hope you can help.

Kind Regards,
Craig.

Submitted by chodges84 on Sat, 2009-08-01 17:36

Forgot to mention - You also kindly installed your keyword mased product mapping mod. I don't know if this could affect it?

Craig.

Submitted by support on Sat, 2009-08-01 18:14

Hello Craig,

It sounds like maybe the database modifications required haven't been completed. Could you download, unzip and upload the debug version of database.php to /includes/ and then exercise the changes again - if this is the case the debug output should indicate which SQL failed and why.

If you could email me your modified files i'll check the changes over for you, and if necessary add some debug code to work out where the problem lies. I'll also look at the changes required to product mapping in order to make it compatible with the name_display mod - at the moment it would only be applied to the main (URL safe) name...

Cheers,
David.

Submitted by chodges84 on Sun, 2009-08-02 13:03

Hi David,

Many thanks for the reply - for now I have replaced the files I modified as above with my backups and al is working ok.

I am stil interested in using - and () in Product mapping titles so if you do know of a way to implement this it would be much appreciated.

Kind Regards,
Craig

Submitted by support on Mon, 2009-08-03 09:01

Hi Craig,

If you could email me your modified versions of the following files:

includes/admin.php
admin/productsmap.php
admin/productsmap_configure.php

...I'll check out the changes required to permit those characters in Product Mapping...

Cheers,
David.

Submitted by ssgupta on Thu, 2009-09-24 06:14

And what is the correct syntax if I want to keep '/' and '-' (without quote, of course) in product name and description? Thanks.

Submitted by support on Thu, 2009-09-24 08:31

Hi,

As long as you are not using $config_useRewrite - which replaces spaces with the "-" character in the URL, then you could use:

$record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]],".\/\-");

(both those characters need to be escaped by the \ character in the regular expression that is the second parameter to tapestry_normalise().

If you are using $config_useRewrite (so it is set to true in config.php) then the above without permitting the hyphen character would be:

$record[$admin_importFeed["field_name"]] = tapestry_normalise($record[$admin_importFeed["field_name"]],".\/");

Cheers,
David.