Press "Enter" to skip to content

e-Commerce: ClickCartPro making all product ids safe

Basically, in ClickCartPro product “identifers” can not have spaces, commas, full stops or brackets in them (basically only the letters A-z, numbers and underscores) and they have to be a maximum length (I’m not sure what the exact maximum is).

If you are maintaining an “established” store (i.e. one with products) where a number of products are showing up on the front end, but when you try to “Add to cart” they don’t appear in the cart then this is probably the problem. To “fix” it (this is more a work around), run the following UNREVERSABLE MySQL code (i.e. make sure you have a backup before hand):

create table temp_replacetest(id varchar(250),hash char(32));
INSERT INTO temp_replacetest (SELECT id,md5(id) from gbu0_prod);
update gbu0_prod,temp_replacetest SET gbu0_prod.xprod=replace(gbu0_prod.xprod,temp_replacetest.id,temp_replacetest.hash) where temp_replacetest.id IN (gbu0_prod.xprod);
drop table temp_replacetest;
update gbu0_prod set id=md5(id);
select id,xprod from gbu0_prod

This will set all product ids to be md5 hashes which, since they only consist of 32 numbers or the letters a-f, are “safe” to use as product identifiers.