If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / Remove "Max:1" from product listing pages in 1.58a

Remove "Max:1" from product listing pages in 1.58a

Started by ted_grapler on 2 May 2024, 4:45 AM · Views: 2,068

Results 1 to 13 of 13
2 May 2024, 4:45 AM
#1
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Remove "Max:1" from product listing pages in 1.58a

ZC 1.58a, PHP 7.4.3

I've done a relatively clean install of 1.58a and haven't been able to remove the text "Max:1", "Max: 2" etc. from my Product Listing pages as shown in the photo below. There are plenty of threads about this but all seem to be for older versions of ZC and the files or code they reference I can't locate.

Have notes about how I removed the text when I installed 1.57 a long time ago but that solution no longer can be implemented.

Any solutions or suggestions are appreciated.

Attachment 20597

2 May 2024, 10:03 AM
#2
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Remove "Max:1" from product listing pages in 1.58a

The code you want to look at is in includes\modules\product_listing.php lines 306 to 322.

case 'PRODUCT_LIST_PRICE':
                    $lc_align = 'center';
                    if ($product_listing_layout_style === 'table') $lc_align = 'right';
                    $lc_text = '';
                    // if ($product_listing_layout_style === 'columns') $lc_text .= '<label>' . TABLE_HEADING_PRICE . '</label>';
                    $lc_text .= $listing_price;
                    $lc_text .= '<br><br>';
                    $lc_text .= zen_get_buy_now_button($record['products_id'], $lc_button, $more_info_button);
                    $lc_text .= '<br>';
                    $lc_text .= zen_get_products_quantity_min_units_display($record['products_id']);
                    $lc_text .= '<br>';
                    if (zen_get_show_product_switch($record['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH')) {
                        if (zen_get_product_is_always_free_shipping($record['products_id'])) {
                            $lc_text .= TEXT_PRODUCT_FREE_SHIPPING_ICON;
                            $lc_text .= '<br>';
                        }
                    }
                    break;

If you don't want to display min or max, you could remove the lines marked in red. I would then save the file back to your template includes\modules\YOURTEMPLATE\product_listing.php so it does not get overwritten. If the file already exists, then modify the file in your template.

Alternatively, if you could hide the code with some css. Again this will hide min and max.

.qmax {
	display: none;
}

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

2 May 2024, 2:57 PM
#3
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Re: Remove "Max:1" from product listing pages in 1.58a

Thanks @brittainmark . That fixed it. It's been a while since I made a donation to Zen Cart team and when I do so soon will dedicate it in your name :smile:

Hopefully down to my last layout issue, and that's with the "Call for Price" text/link showing up for items I've sold and am keeping as an archive, as shown in the photo below. Was able to remove it by changing the text in lang.english.php ('TEXT_CALL_FOR_PRICE' => '',) but that gives lots of warnings in log for Undefined Constant.

Best way to remove or hide this link/text?

Previously I got rid of unwanted "More Info..." on product listing pages by adding to stylesheet.css this line " a.list-more {display: none;}"

Wondering if I can do this with Call for Price text/link and if so what would the code added to stylesheet.css be? Or if there is a correct way to do it that would be better.

Attachment 20598

2 May 2024, 3:44 PM
#4
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Remove "Max:1" from product listing pages in 1.58a

Why is the product set up as call for price in the first place?
If the product has been sold and is not set up as call for price, and you don't allow people to buy sold out products, then it will appear but not show call for price.

On the product set "call for price" to "no"
In Admin>Configuration>Stock set "Allow Checkout" to "false".

If you want to leave the product on the system but not have customers see it you can turn it off.

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

2 May 2024, 4:30 PM
#5
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Re: Remove "Max:1" from product listing pages in 1.58a

Thanks for the quick reply.

Many years ago decided I wanted to keep all my unique sold items online and searchable. I've never used the "Call for Price" feature so I just changed the call for price image into a "SOLD" image that was impossible to miss.

Buyers can't purchase an item marked Call for Price. Sold items are moved to a category called Archives. I was trying to do something like when you search on fleebay under Completed Listings. Probably a half-a*** way to go and am sure there are better ways but after a decade+ got used to it. If it ain't broke don't fix it? I don't know.

Can I just add * ?????? {display: none;} * to stylesheet.css to hide this, and if so what would I put for ??????

brittainmark:

Why is the product set up as call for price in the first place?
If the product has been sold and is not set up as call for price, and you don't allow people to buy sold out products, then it will appear but not show call for price.

On the product set "call for price" to "no"
In Admin>Configuration>Stock set "Allow Checkout" to "false".

If you want to leave the product on the system but not have customers see it you can turn it off.

2 May 2024, 4:47 PM
#6
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Re: Remove "Max:1" from product listing pages in 1.58a

To be more clear:

I'm using the "Call for Price" feature to display an image next to listings wherever they are. The image says "SOLD" in neon yellow.

This shows up wherever the product is listed- in New Products, All Products, category product listing pages, product page, etc. Also on all the Admin pages. I've co-opted a feature for a purpose it wasn't intended to be used for, and it's always worked as I wanted it to so never put much thought into it after setting it up. It just worked.

Ted Grapler:

Thanks for the quick reply.

Many years ago decided I wanted to keep all my unique sold items online and searchable. I've never used the "Call for Price" feature so I just changed the call for price image into a "SOLD" image that was impossible to miss.

Buyers can't purchase an item marked Call for Price. Sold items are moved to a category called Archives. I was trying to do something like when you search on fleebay under Completed Listings. Probably a half-a*** way to go and am sure there are better ways but after a decade+ got used to it. If it ain't broke don't fix it? I don't know.

Can I just add * ?????? {display: none;} * to stylesheet.css to hide this, and if so what would I put for ??????

3 May 2024, 11:28 AM
#7
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Remove "Max:1" from product listing pages in 1.58a

You can find these yourself by using the inspector on your browser. See https://docs.zen-cart.com/user/running/inspect/ for google chrome. Other browsers are similar. Then try the element you think you need. If that does not do it, try the parent or make the CSS more precise. Loop as required. Then, when you have made the change, test other pages to make sure you have not changed them as well.

Try

#btnCallPrice {
	display: none;
}

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

3 May 2024, 10:27 PM
#8
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Re: Remove "Max:1" from product listing pages in 1.58a

brittainmark again thanks for your help. I tried the code you suggested in stylesheet.css and had no affect on this situation.

Have tried using browser Inspector previously to track down a solution, had no luck. The "Call for Price" text and link I want to get rid of for the items I've marked as Sold shows like this in Inspector:

*<!--bof Add to Cart box --> == $0

<div id="cartAdd"> == $0 <a href="https://mysite.com/index.php?main_page=ask_a_question&pid=6665">Call for Price</a> </div> <!--eof Add to Cart Box-->*

By experimenting I was able to get rid of the text and link it by removing Add to Cart somewhere in the code, but it also removed Add to Cart from all my items that were still available. So need to narrow it down so it only removes it for items I've marked as Call for Price(ie SOLD).

Am pretty sure with Zen Cart 1.57 I just removed the text (lang.english.php to ('TEXT_CALL_FOR_PRICE' => '',) that still works fine in 1.58a but will give log warnings - "Undefined Constant that will cause errors in future versions."

All suggestions are appreciated.

brittainmark:

You can find these yourself by using the inspector on your browser. See https://docs.zen-cart.com/user/running/inspect/ for google chrome. Other browsers are similar. Then try the element you think you need. If that does not do it, try the parent or make the CSS more precise. Loop as required. Then, when you have made the change, test other pages to make sure you have not changed them as well.

Try

#btnCallPrice {
display: none;
}

4 May 2024, 8:28 AM
#9
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Remove "Max:1" from product listing pages in 1.58a

What template are you using?

This may work, but I don't know what to test against

#cartAdd a[href^="https://mysite.com/index.php?main_page=ask_a_question"] {
  display:none;
 }

You will have to change mysite.com to the correct url. This is looking in the element with id "cartAdd" (<div id="cartAdd">) for a link <a> with a link (href) that starts "https://mysite.com/index.php?main_page=ask_a_question"

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

4 May 2024, 1:46 PM
#10
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Re: Remove "Max:1" from product listing pages in 1.58a

I tried adding to stylesheet.css

#cartAdd a[href^="https://mysite.com/index.php?main_page=ask_a_question"] {
display:none;
}

But it did not remove the link and text. I did change mysite.com to actual name of my website.

I've got a temp solution and this is simply changing the text in lang.english.php on line 382 to *'TEXT_CALL_FOR_PRICE' => 'Out of Stock',
*
It's not ideal because it adds redundant info and takes up additional space on the pages, but looks like only shows up when viewing my Archives category and I can live with that. It actually might be a good thing because sometimes people email me about availabilty of items marked with the yellow SOLD image, this will reinforce that the item is gone.

Still looking for suggestions

THANKS.

brittainmark:

What template are you using?

This may work, but I don't know what to test against

#cartAdd a[href^="https://mysite.com/index.php?main_page=ask_a_question"] {
display:none;
}

> 
> You will have to change mysite.com to the correct url. This is looking in the element with id "cartAdd" (<div id="cartAdd">) for a link <a> with a link (href) that starts "https://mysite.com/index.php?main_page=ask_a_question"
4 May 2024, 2:31 PM
#11
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Remove "Max:1" from product listing pages in 1.58a

Is your site live? Can you send me a link if so and I'll have another look.

Mark Brittain
http:\innerlightcrystals.co.uk\sales\

6 May 2024, 5:27 PM
#12
ted_grapler avatar

ted_grapler

New Zenner

Join Date:
Nov 2015
Location:
New Jersey USA
Posts:
76
Plugin Contributions:
0

Re: Remove "Max:1" from product listing pages in 1.58a

Thanks to brittainmark this has been solved. He suggested adding two lines to stylsheet.css and they made the unwanted links/text disappear from my product listings and index pages.

*#cartAdd a[href^="https://MYSITE.com/index.php?main_page=ask_a_question"] {
display: none;
}

#productListing a[href^="https://MYSITE.com/index.php?main_page=ask_a_question"] {
display:none;
}*

Thank you!

7 May 2024, 11:42 AM
#13
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
509
Plugin Contributions:
1

Re: Remove "Max:1" from product listing pages in 1.58a

Thanks for updating the post.

Mark Brittain
http:\innerlightcrystals.co.uk\sales\