You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
Pages: 1
If a product name starts with a number such as a year, like "2008 Gold Commemorative Coin", how is that handled in the product index that is sorted by letter?
I know it relies on the prodidx column value of the product db table ccp0_prod. I have my working products spreadsheet set to pull the first character of the name field and place it in the prodidx column.
So if a product starts with 2008 the value entered that column would be 2... and theoretically should have its own page of all products that start with 2.
Right now apparently only letter values are recognized in that field by ccp6.
How can I alter the code so that pages will be made if it finds a number in that field, and all the products that start with that number will be listed on that number's page just like it does for the letters?
It would need to handle 1-9 along with the way it handles A-Z.
Offline
theblade24 wrote:
If a product name starts with a number such as a year, like "2008 Gold Commemorative Coin", how is that handled in the product index that is sorted by letter?
Numbers are not provided as an option for indexing as CCP is delivered so a) numbers couldn't be selected and b) they wouldn't show up in the product index.
theblade24 wrote:
How can I alter the code so that pages will be made if it finds a number in that field, and all the products that start with that number will be listed on that number's page just like it does for the letters?
It should be possible by adding 9 entries to the khxc_selectcustom table for each of the numbers 1-9. In raw DB admin enter the following:
INSERT INTO `khxc_selectcustom` VALUES('ccp0.prodidx.1', 'ccp0', 'ccp0.prodidx', '1', '1', 27)
changing the 3 instances of 1 in that command to 2, 3, 4 etc and incrementing the 27 each time (ie: 28, 29, 30 etc).
Offline
Thats excellent and gives me the new pages 1-9.
They are not however appearing in the array with all the other letters so they can be selected.
Do they need to be added to that array somewhere?
Offline
That would have added them to the select drop-down in the product page in admin. That's the only place that needs to be changed. I added the one using the command I posted, updated a product and it showed up in the index with 1 as expected.
Offline
If I change a link to
/ccp0-prodidx/1.html then yes all products that start with 1 show up.
But in this array
Index: A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | R | S | T | V | W | X | Y | Z | | | | |
thats what I'm getting and the choices for 1-9 are not there.
Offline
You must have changed something Like I said, when I did it the 1 showed up immediately after the Z. In a stock installation only letters that have products assigned to them will show up (FWIW). Looking at the source of your index page it does look like you've changed the include that displays the index so that would be the first place to check sir.
Offline
I'm assuming you mean this include? Product Index Nav Display
I took my code saved as a file, went to the demo install and got the code there and saved as another file.
I used a file compare tool and they are identical. I haven't changed anything.
Offline
I see I'm also getting | | | | | at the end.... but that was there before I added the 1-9 items. So something is causing that for some reason.
Offline
That may be caused by a product entry not having a value in the index column. You're importing you products from a CSV if I recall correctly. May want to check the index column and see if you have any that are blank or have other non alphameric values.
Offline
In a normal installation the only letters that should show up on the index line are those that have products associated with them. My development line looks like this for example:
Index: B | E | F | G | M | N | O | P | Purple | S | T | 1
Offline
I just went up and down my file and there is nothing in that column but A-Z or 1-9. Unfortunately.
I removed 20 or so entries in that column that had numbers like 1 2 3 4 5 that were because products start with that letter.
Uploaded file, and poof... those extra ||||| at the end of the display were gone.
Ideas?
Offline
Quite odd. After I added the numbers to the custom select table as shown earlier my test product that I set the index to 1 showed up just like it was supposed to.
Offline
Any ideas of where to go next?
Offline
I can see in the product table where a product has the proper dropdown selection of 1 for the prodidx field.
And it is found if I manually alter the url to 1.html.
But I am getting the pipes at the end of the nav listing and it won't show the letter choices.
If I clear the products db of any numbers in the prodidx column, no pipes appear and all is good.
What could be causing the way it is handling the number values in that column?
Offline
Ah I think I know what it is. In the product index include look for this line:
$idx = $data['prodidx'];
and change it to:
$idx = $data;
Offline
Spot on Mate! That did the trick!
Any idea why it worked for you?
"Quite odd. After I added the numbers to the custom select table as shown earlier my test product that I set the index to 1 showed up just like it was supposed to."
Offline
Yea, I have a change to that include that will be in the next update and I'd forgotten about it completely. I discovered that while helping someone use words for indexing instead of just letters. After I walked away from the computer for a while doing other things it dawned on me
Offline
Pages: 1