Does each product have a unique product ID (or can that be made, fx. by just adding a sequential number in the database).
And if so, how can I use it in the php files?
I will use it in two ways:
1: Instead of all products having the same META title and description I will mix it up a bit like this:
IF [last-digit-in-unique-product-number] == 1
TITLE == This is title1
ELSEIF [last-digit-in-unique-product-number] == 2
TITLE == This is title2
etc-
2: I am auto-generating unique html-files with text for all products.
I was thinking of naming these 1.html...1000000.html
In the product php I was thinking of just calling them with a single line of code
[include ../product-html/[unique-product-number].html]
Would this be possible?
Hi thank you for your reply, this helps a lot with the title.
For the unique text perhaps you you can say if I understand it correctly?
I am using a simple homemade ruby-program to generate the html-files, using some word-lists and randomization, and then making many files at once.
So just to understand correctly I can
i) import all my products
ii) download the normalized name field from the product table
iii) replace " " with "-" and add .html at the end
iiii) add this list to my file-generating-program as the name of the files
and then I'm good to go, and can just re-do these steps if I add new products?
And then I suppose I can also do the same with categories, brands and merchants, if I would like some text under the products?
Thank you very much for your help :-)
Hi,
> i) import all my products
> ii) download the normalized name field from the product table
> iii) replace " " with "-" and add .html at the end
> iiii) add this list to my file-generating-program as the name of the files
Sounds good to me!
Cheers,
David.
--
PriceTapestry.com
Hi,
In order to keep the database optimal and not fragmented, the CRON / Import ALL process starts by truncating (emptying) the database, so although there is an id field on the products table it is not permanently associated with a particular products.
Also, bear in mind that a product page features multiple merchants, so even if the id field were to be made persistent, as prices change and different merchants become cheapest the id field of first product record for a product page is likely to change.
Therefore, what I would recommend, for the purposes of mixing up the title would be to i) make an md5 hash of the product name, and then ii) take the hexdec() value of the first character of the hash, which will give you a value between 0 and 15, and will always be the same for any given product name.
To give this a go for variation of the title, edit products.php and look for the following code at line 64:
$header["title"] = $product["products"][0]["name"];
...and REPLACE with:
$n = hexdec(substr(md5($product["products"][0]["name"]),0,1));
switch($n)
{
case 0:
$header["title"] = "This is title 0 before ".$product["products"][0]["name"]." and after";
break;
case 1:
$header["title"] = "This is title 1 before ".$product["products"][0]["name"]." and after";
break;
// etc.
default:
$header["title"] = $product["products"][0]["name"];
break;
}
Regarding individual product text, the easiest thing to do would be to create files in your /product-html/ folder exactly matching the URL version of the product name (which is derived from the normalised_name field with hyphens in place of spaces). So for example, for
http://www.example.com/product/Product-Name.html
...create the file
/product-html/Product-Name.html
And then as required in html/product.php, use for example:
<?php
$filename = "/product-html/".tapestry_hyphenate($product_main["normalised_name"]).".html";
if (file_exists($filename))
{
require($filename);
}
?>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com