Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Turning Shopping Cart On/Off By Category

Turning Shopping Cart On/Off By Category

Locked

Views: 1,826

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
25 Oct 2007, 9:27 PM
#1
smallarmsdealer avatar

smallarmsdealer

New Zenner

Join Date:
Oct 2007
Posts:
16
Plugin Contributions:
0

Turning Shopping Cart On/Off By Category

Hey everyone!

So far I've just lurked these super helpful forums, but now I'm hoping someone will be able to help me as a newbie!

I convinced the company I work for to use zencart :clap: but they give me sheets of paper with drawings on it to illustrate what they want.

Well, mostly this involved me turning off all sideboxes, etc in Layout Boxes Controller and making my own template to match our current site: http://www.crystalvalley.com/zencart/

OK, so! I want all categories (for now) to have no option to buy the products (we have distributors who sell them) EXCEPT the category [B]Banner Hardware[/B].

What do you think?

Basically I want to turn back on the shopping cart box for add to cart on just one category.

Help!

Thanks in advance,
mike (smallarmsdealer)

25 Oct 2007, 10:10 PM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Turning Shopping Cart On/Off By Category

The Gallery Category mod will do what you need. Turn the cart back to full normal function, and add all the categories except the Banner Hardware to the Gallery Category list per the directions in the readme. If you want prices to show for the gallery categories, there are directions for disabling the "hide price" function.

You can remove any categories from the gallery function at any time.

25 Oct 2007, 10:22 PM
#3
kobra avatar

kobra

Black Belt

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

Re: Turning Shopping Cart On/Off By Category

You might also spank this up a bit by adding appropriate images to each category that will display just over the text for each in the center area

25 Oct 2007, 10:22 PM
#4
smallarmsdealer avatar

smallarmsdealer

New Zenner

Join Date:
Oct 2007
Posts:
16
Plugin Contributions:
0

Re: Turning Shopping Cart On/Off By Category

Thank you, GJH42!

I will try that and report back to the thread!

This will just about make my day if this works!

25 Oct 2007, 10:23 PM
#5
smallarmsdealer avatar

smallarmsdealer

New Zenner

Join Date:
Oct 2007
Posts:
16
Plugin Contributions:
0

Re: Turning Shopping Cart On/Off By Category

@kobra:

Duly-noted, my friend.

I was thinking the same thing yesterday. That would spice things up!

25 Oct 2007, 10:35 PM
#6
kobra avatar

kobra

Black Belt

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

Re: Turning Shopping Cart On/Off By Category

If you have images for these then

admin > catalog > categories/products > select category and the edit function > towards the bottom you can browse to the image on your local and update/preview

26 Oct 2007, 6:13 PM
#7
smallarmsdealer avatar

smallarmsdealer

New Zenner

Join Date:
Oct 2007
Posts:
16
Plugin Contributions:
0

Re: Turning Shopping Cart On/Off By Category

Just wanted to write back to the thread -- so far I've downloaded/unzipped the Gallery Category Mod, renamed the proper folders to my custom template, and uploaded it to the root zencart folder. I guess it doesn't show up under Tools like Image Handler (drats!)

I'm working on following these directions, one question that popped up was in editing the product_listing.php file per Gallery Category's read me. It says to replace the default 23 to hide that category, but how do I do multiple? In my case, all except for one category (category 22).

Stumbling along here, Friday is a tough day to get any real work done!

26 Oct 2007, 6:35 PM
#8
gjh42 avatar

gjh42

Black Belt

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

Re: Turning Shopping Cart On/Off By Category

The readme explains (at the bottom) how to add multiple category ids to the list.


If you wish to have multiple categories or subcategories display as galleries, you can add them to the list in this line:

if (ereg("(^23$|^23_)",$cPath)) {

^23$ means "exactly 23", | means "or", and ^23_ means "begins with 23_".
To add category 2 and subcat 7_13, the list would look like this:
(^23$|^23_|^2$|^2_|^7_13$) and the whole line would look like this:

if (ereg("(^23$|^23_|^2$|^2_|^7_13$)",$cPath)) {


26 Oct 2007, 9:14 PM
#9
smallarmsdealer avatar

smallarmsdealer

New Zenner

Join Date:
Oct 2007
Posts:
16
Plugin Contributions:
0

Re: Turning Shopping Cart On/Off By Category

OK, I edited both tpl_product_info_display.php and product_listing.php with this string:

if (ereg("(^5$|^5_|^6$|^6_|^7$|^7_|^8$|^8_|^9$|^9_|^10$|^10_|^11$|^11_|^12$|^12_|^13$|^13_|^14$|^14_|^15$|^15_|^16$|^16_|^18$|^18_|^19$|^19_|^20$|^20_|^21$|^21_|^23$|^23_|^24$|^24_)",$cPath))

All of those categories being the categories I don't want product to be bought on/in. Categories I do want: 17 (banners) and 22 (banner hardware).

I think I've edited out some other stuff when making zen cart fit in with our site...I've enabled shopping cart to be right and have global right column enabled. See nothing. I'll try to enable more and more here, but so far I think i need to go back in and find some code.

OK -- I see the importance of notes and commenting what I've commented out! :P

26 Oct 2007, 9:38 PM
#10
gjh42 avatar

gjh42

Black Belt

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

Re: Turning Shopping Cart On/Off By Category

The categories you want to use are actually subcategories, and need to be specified as such in the ereg list.
"Banners" cPath=3_17
"Banner Hardware" cPath=3_4
(both should not be in the ereg list)
If you don't want Banner Enhancers (cPath=3_18) functional, then you need to include that in the ereg list.

Since cPath 3 is not in your current list and not subject to gallery treatment, but still not showing cart function, you obviously have a bunch of things to restore in the code.

26 Oct 2007, 9:57 PM
#11
smallarmsdealer avatar

smallarmsdealer

New Zenner

Join Date:
Oct 2007
Posts:
16
Plugin Contributions:
0

Re: Turning Shopping Cart On/Off By Category

Ah, I see, Glenn.

I sure feel silly now! Duh.

This is what I'm doing now...I think this code is saying this: category 1 and all its subcats are galleries, category 2 and its subcats are galleries, and these specific subcats of 3 are galleries.

Am I getting closer? :-D

if (ereg("(^1$|^1_5|^1_6|^1_7|^1_8|^1_9|^1_10|^1_11|^1_12|^1_13|^1_14|^1_15|^1_16|^2$|^2_19|^2_20|^2_21|^3_18|^3_4_24|^3_4_23)",$cPath)

27 Oct 2007, 7:44 AM
#12
gjh42 avatar

gjh42

Black Belt

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

Re: Turning Shopping Cart On/Off By Category

You're just about there!
This will work, but you don't need to specify every one of a category's subcats if you want them all to be included in the list; ^1$|^1_ will do it. ^1$ means "cPath 1 exactly" (the top cat only), and ^1_ means "all subcats of category 1". Together they cover cat 1 and its subcats.

So your list could look like```php
if (ereg("(^1$|^1_|^2$|^2_|^3_18$|^3_4_24$|^3_4_23$)",$cPath)) {

1 Nov 2007, 10:03 PM
#13
smallarmsdealer avatar

smallarmsdealer

New Zenner

Join Date:
Oct 2007
Posts:
16
Plugin Contributions:
0

Re: Turning Shopping Cart On/Off By Category

Wanted to reply back to the thread!

Everything went well. Thanks, Glenn! :D

Some add'l details to help others in the future:

I was missing the "add to cart", so I went to Admin>Catalog>Product Types and saw that Product - General had Add to Cart disabled. I disabled it while I was trying to customize zen cart to our website. My boss didn't like the sold out buttons, so I went there and disabled that. If only I knew what I know now!

Also, as an aside, I have options for certain products or product attributes. Originally, I tried creating two new option names. Turns out that was the wrong way as both radio buttons were checked and added both prices to my cart! Right way: create an option name with several different option values.

In my case it was Option Name: W or W/O Banding, Option Value: W Banding, Option Value 2: W/O Banding...from there I just used Attributes Control to increase or decrease price based on what option was chosen. Solved the both radio buttons checked issue!

All is well now...oh and, Kobra, I added category images to spice it up. :-) However, I have image handler disabled at the moment (crashing some things) so if you're on dial-up prepare for some slowness:

http://www.crystalvalley.com/zencart/index.php?main_page=index&cPath=1