If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / Custom page to have the layout of products catalog

Custom page to have the layout of products catalog

Locked

Started by zeppelin on 26 Dec 2010, 5:33 PM · Views: 2,063

Results 1 to 20 of 33
This thread is locked. New replies are disabled.
26 Dec 2010, 5:33 PM
#1
zeppelin avatar

zeppelin

New Zenner

Join Date:
Dec 2010
Posts:
14
Plugin Contributions:
0

Custom page to have the layout of products catalog

Hello everyone.

I have a custom page that I want to look EXACTLY like the
?main_page=index&cPath=whatever

the only difference is cPath won't work for me anymore (unfortunately, thus I have to to write custom php to query products table and find the products I want to include depending on a custom column in products).

So I need to show the same layout but make sure the data is differently filtered. What to do? I've been struggling with this issue and cannot seem to find one place to say how index&cPath is rendered so I can alter the SQL query and force mine there (or I'll have to do this eitherway in my custom page)

26 Dec 2010, 8:05 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Custom page to have the layout of products catalog

only difference is cPath won't work for me anymore (unfortunately
Why is this?

Zen-Venom Get Bitten

26 Dec 2010, 9:01 PM
#3
zeppelin avatar

zeppelin

New Zenner

Join Date:
Dec 2010
Posts:
14
Plugin Contributions:
0

Re: Custom page to have the layout of products catalog

in the database, there are 6 categories for products. but each product has a custom column which is more detailed categories and now we want to use that one sometimes. So we're happy with the 6 categories but we wanna give the user more options if he wants to go deep (I know about cPath being able to do ABC_EFG where EFG is a subcategory of ABC [if I understand correctly]) but as the database is already different I cannot do that either.

Thus I need a method to show the same layout with just different data (I know the SQL I want to write)

26 Dec 2010, 11:50 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Custom page to have the layout of products catalog

Load your page and get the url end

Such as

/index.php?main_page=my_page

Then make a folder in /your template/my_page/

Put a custom copy of tpl_main_page.php in it

Customize this to your needs

Zen-Venom Get Bitten

27 Dec 2010, 12:13 AM
#5
zeppelin avatar

zeppelin

New Zenner

Join Date:
Dec 2010
Posts:
14
Plugin Contributions:
0

Re: Custom page to have the layout of products catalog

kobra thanks for helping man.
Since I 've read the wiki on how to create a new page, you're saying the product listing layout is in tpl_main_page.php page and all I have to do is what then? I've looked into the page (can be found also http://phpxref.com/xref/zencart/includes/templates/template_default/common/tpl_main_page.php.source.html) and nowhere does it include the layout I want nor the sql query to change. It just goes on to include other tpl_ files and I lose it from there

27 Dec 2010, 12:20 AM
#6
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Custom page to have the layout of products catalog

you're saying the product listing layout is in tpl_main_page.php page
Actually not - - Default Product layout in tpl_product_info_display.php but I am guessing you are not using it as there is only one and you state you have 6 layouts

Zen-Venom Get Bitten

27 Dec 2010, 12:26 AM
#7
zeppelin avatar

zeppelin

New Zenner

Join Date:
Dec 2010
Posts:
14
Plugin Contributions:
0

Re: Custom page to have the layout of products catalog

koba, thanks again for helping me and sorry to confuse you.
I don't have 6 layouts. I have 6 cPaths and I cannot add more there.
I have a lot of products belonging to one of those 6 cpaths. I also have a special column for those products. I want to use that column to feed the same page or another page I don't mind as long as it keeps the same layout and form as the one with cPath.

This is what I want to do, I hope you can you help me. (I'm a rookie in zencart, but not to programming)

so what I want is ?main_page=index&cPath=WHATEVER&myCOL=ABC or even better ?main_page=index&myCol=ABC and this should show all those products that have myCOL=ABC (myCol is an extra col I've added in the products table) or at worse ?main_page=mypage?myCol=ABC (but mypage show use the layout of index?myCol and where is that and how to do that)

27 Dec 2010, 4:38 AM
#8
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Custom page to have the layout of products catalog

I don't have 6 layouts. I have 6 cPaths and I cannot add more there.
I have a lot of products belonging to one of those 6 cpaths.

I also have a special column for those products.
From your explanation, I do not understand what it is you are attempting.

Zen-Venom Get Bitten

27 Dec 2010, 6:31 AM
#9
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,904
Plugin Contributions:
23

Re: Custom page to have the layout of products catalog

This is one of those where we REALLY need some of the information from the posting tips!

Can't imagine a limit on cpath:shocking:

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

27 Dec 2010, 12:25 PM
#10
zeppelin avatar

zeppelin

New Zenner

Join Date:
Dec 2010
Posts:
14
Plugin Contributions:
0

Re: Custom page to have the layout of products catalog

ok I'll try to rephrase:
products table:

pid cpath specialCol
1    1234   155
2    1234   156
3    1235   155
4    1234   188

I want to show a page asking products where specialCol is 155 and this page ideally should have the looks like the one shown if I do cPath=1234

27 Dec 2010, 4:23 PM
#11
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Custom page to have the layout of products catalog

I want to show a page asking products where **specialCol **is 155 and this page ideally should have the looks like the one shown if I do cPath=1234
Your are talking in theoritics with "1234" and the like

specialCol is something that we have no way of knowing what it is
You might have to post the file that you have this custom code in

And a link to where it can be seen is always a help

Zen-Venom Get Bitten

27 Dec 2010, 5:38 PM
#12
zeppelin avatar

zeppelin

New Zenner

Join Date:
Dec 2010
Posts:
14
Plugin Contributions:
0

Re: Custom page to have the layout of products catalog

specialCol is a one more extra field (INT) in products table. I want to use that a filter instead of cPath (category) sometimes. I want to ouput the products with the same HTML they are rendered when using cPath. I cannot post code since it's not running live yet. Thanks.

27 Dec 2010, 5:41 PM
#13
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Custom page to have the layout of products catalog

specialCol is a one more extra field in products table. I want to use that a filter instead of cPath (category) sometimes. Thanks
Great - - Where is the code & a live example?

"I have an issue and it is a secret - - can you tell me how to fix it?"

Zen-Venom Get Bitten

27 Dec 2010, 7:30 PM
#14
zeppelin avatar

zeppelin

New Zenner

Join Date:
Dec 2010
Posts:
14
Plugin Contributions:
0

Re: Custom page to have the layout of products catalog

there is no secret man. I cannot post code since it's not running live yet. Moreover I've asked a question if it's possible or not to be answered does not depend on the access of the code (after all I haven't done any special coding apart from the database extra column). It is what I ask where to hack so I can start hacking it. thanks

27 Dec 2010, 11:18 PM
#15
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Custom page to have the layout of products catalog

What you are asking is too undefined to give a definite answer for. You can add additional/different parameters to the URL (more advanced than I know how to do), and you have not said definitely which page you want a different layout for: is it the product listing or the product info page?

27 Dec 2010, 11:40 PM
#16
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Custom page to have the layout of products catalog

I've asked a question if it's possible or not
If it is programatically possible then there is no reason one can not do it
I cannot post code since it's not running live yet.
So why does that prevent you from posting the code???
It is what I ask where to hack so I can start hacking it. thanks
Still have not explained enough of what you are attempting to even make a guess

Zen-Venom Get Bitten

28 Dec 2010, 7:24 PM
#17
zeppelin avatar

zeppelin

New Zenner

Join Date:
Dec 2010
Posts:
14
Plugin Contributions:
0

Re: Custom page to have the layout of products catalog

@gjh42, I want to change the product listing

@kobra, please stop quoting me, and read and if you can help. else please stop posting but never answering I would show you my code but I haven't coded anything (that's what I'm asking). I know it's possible, the problem is how on earth is product listing being layout on zencart (it's what I'm asking). Moreover there is nothing to show to you since I only have one extra column in the database (and the .sql dump file is 1GB).

28 Dec 2010, 11:26 PM
#18
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Custom page to have the layout of products catalog

If you haven't yet found that the product listing is built in /includes/modules/your_template/product_listing.php, I think you should study the ZC structure a bit more before making changes to it. Product_listing.php has some complex code in it, and you need to understand fully how it works to avoid errors when modifying it. You might look at the files in Column Layout Grid in Free Addons to see an example of reworking that code for displaying in columns or rows depending on an admin setting.

Before I can advise any kind of modification route, I need to know how you want it to work.
Do you want to lay out the current info differently for the special groups you have made?
Do you want to add new info or fields to the display of these groups?
Do you want different products in the same listing laid out differently? (That would be very complex and probably difficult.)
Do you want to list all of a standard category's products, or all of a special group's products?

28 Dec 2010, 11:38 PM
#19
zeppelin avatar

zeppelin

New Zenner

Join Date:
Dec 2010
Posts:
14
Plugin Contributions:
0

Re: Custom page to have the layout of products catalog

I know which pages I have to look for changing, but I'm very frustated since I've lost a lot of time trying to understand the code in those files you mention and guess what I didn't since there is no logic seperation and there is little to no documentation what is going on (aka spaghetti).

When I ask zencart &cPath=1234 and it lists all the products belonging to that category. What I would like to do is instead of cPath pass &myField=5555 and it would list all the products that have 5555 as their myField in their records. The layout should be exactly the same as the one of cPath.

Now before writing here, I took the time tracking done where on earth cPath value is read and where is the SELECT query that retreives the results for all the products in the asked cPath executed without much luck. I was hoping to find that place and try to understand the logic. Then I would mimic this and hoping to have my customField.

so in pseudocode, if I were to find where the value of cPath is checked and the SELECT happens, I was hoping I could do:

if(cPath is given) // ALREADY THERE
 SELECT * from products where category_id = cPath // ALREADY THERE
else if (myField is given) // MY CUSTOM THING
 SELECT * from products where myFieldCol = myField

I hope I made my self understood, and hopefully you can help me track the whereabouts of that logic in zencart. Thanks a ton!

28 Dec 2010, 11:51 PM
#20
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,904
Plugin Contributions:
23

Re: Custom page to have the layout of products catalog

I'm afraid I agree with Glenn that you need to become more familiar with the way Zen Cart works before re-inventing the wheel.

Each post gets me a little closer to thinking I might have a clue as to what you want and each also makes me think that you are bypassing what Zen Cart can do in order to make it do what you want it to do.

I keep coming back to link. copy and duplicate. I'm not sure that is your goal, but take a look at https://www.zen-cart.com/tutorials/index.php?article=216 and https://www.zen-cart.com/tutorials/index.php?article=325 to see if either of those is close to what you want.

Maybe we can use that as common ground to discuss this further.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com