Forums / General Questions / Checkbox instead of buy now button on all products page

Checkbox instead of buy now button on all products page

Started by linuxguy2 on 27 Nov 2013, 5:49 PM · Views: 5,288

Results 1 to 20 of 58
27 Nov 2013, 5:49 PM
#1
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Checkbox instead of buy now button on all products page

Hi,

I want to select multiple products (Check Box) on the "All Products" page and then add them to the cart all at once.
I have searched the web and the zc forums & plugins for hours but haven't been able to find any thing. Any pointers or suggestions would be Greatly Appreciated.
NOTE:
As far as I know using Attributes will not accomplish this function.

BTW
THANKS! to the zc community for the 6 add ins I am using.

27 Nov 2013, 5:56 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

In a stock Zencart installation, the All Products listing does have quantity boxes (except thos products with attributes), so we'll need to see your site.

27 Nov 2013, 7:01 PM
#3
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Checkbox instead of buy now button on all products page

Stevesh,
Thanks for your responce.
I cannot show you the site just yet as I need to protect my clients' interests before we go into production.
In my searches I have come across other zenners wanting a similar function.
I have been using zc for several years now and am familiar with all the combinations of product entry options and attributes.
None of these options provide a checkbox on the All Products page.

Simply put I want to be able to scroll down the All Products page checking off the items I want to order and then click a button that will add them all to the cart at once.

I know this is not a trivial task but with all the plugins out there I thought someone may have already done something like this.

I can deal with disabling/not displaying any other buy now buttons or quantity boxes on the page.

27 Nov 2013, 7:17 PM
#4
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

I guess my point was that it has already been done, unless I don't exactly understand the question. Here's my All Products page from a bone-stock test installation, using all the default admin options, and no plugins:

http://www.stevesh.com/demo/index.php?main_page=products_all

27 Nov 2013, 7:50 PM
#5
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Checkbox instead of buy now button on all products page

I am aware of that option(s)

I don't want the reps/customers to have to enter any values, Just check a box for each item on the All Products page they want to buy and then click a single "Add To Cart" button to add them all at once. They will be working from a tablet.
It would add whatever minimum amount I entered when adding the product to the catalog. (see graphic)

My problem is I'm not a coder. Usually I get a lead to a plugin that does what I want with some minor hacking :-) .......

Below is how I enter my products.
I have been using zc for several years now and am familiar with all the combinations of product entry options and attributes and I don't think I can get the checkbox with those options.
I don't know of any of these options coupled with attributes that would provide a checkbox on the All Products page.

27 Nov 2013, 9:37 PM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

linuxguy2:

I am aware of that option(s)

I don't want the reps/customers to have to enter any values, Just check a box for each item on the All Products page they want to buy and then click a single "Add To Cart" button to add them all at once. They will be working from a tablet.
It would add whatever minimum amount I entered when adding the product to the catalog. (see graphic)

My problem is I'm not a coder. Usually I get a lead to a plugin that does what I want with some minor hacking :-) .......

Below is how I enter my products.
I have been using zc for several years now and am familiar with all the combinations of product entry options and attributes and I don't think I can get the checkbox with those options.
I don't know of any of these options coupled with attributes that would provide a checkbox on the All Products page.

Also not saying easy, but thinking (based on viewing the page source for stevesh's site) that wherever the html for input type="text" name="products_id[X]" value ="[minimum quantity]" etc... is put, that there is a checkbox definition instead with the same related information that when the add selected products to cart button is pressed, all of the checked items are reviewed such that if the checkbox of that named item is checked then add that item to the cart instead of verifying that the value assigned to the item is something other than zero... I haven't looked at the downstream code (action from pressing the button), but that seems to be what the OP is asking for. As far as the attribute side of things, well, seems like another story....

How to flag this to happen only for one thing and not another, is yet another story... (ie., recognizing that ZC code is reused in a number of places, and changing the code rather than adding to it, could have an effect down stream in the future...)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

27 Nov 2013, 11:13 PM
#7
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Checkbox instead of buy now button on all products page

Thanks for your reply,
I agree it won't be easy to implement but I think it's doable. Maybe that's why there isn't a check box plugin for the Products Listing page itself.

However there is a like function when you change item amounts in the shopping cart and click the global update.
Also the remove from cart has a check box so you can remove multiple items at once.

Hopefully others who are more familiar with the code will chime in but meanwhile I'm going to look at those two functions.

[Attachment no longer available]

27 Nov 2013, 11:30 PM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

linuxguy2:

Thanks for your reply,
I agree it won't be easy to implement but I think it's doable. Maybe that's why there isn't a check box plugin for the Products Listing page itself.

However there is a like function when you change item amounts in the shopping cart and click the global update.
Also the remove from cart has a check box so you can remove multiple items at once.

Hopefully others who are more familiar with the code will chime in but meanwhile I'm going to look at those two functions.

[Attachment no longer available]

So, one of the things I was thinking about, and only making an assumption of how I think the code works is, that in the routine that inspects the returned values from "moving to the next page" if the input type is inspected and is a checkbox, to validate it's status, if checked add the value amount to the cart (this last part would follow standard processing), if the input type isn't a checkbox, then to inspect it like usual looking for a non-zero (probably positive) value to add to the cart. May not be as easy as that, but implementation would use a template modified version of code to process, so as not to lose core functionality. Thinking no core mods necessary, but that totally depends on well the dependencies.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

27 Nov 2013, 11:44 PM
#9
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

I missed the checkbox part of your original question. Unfortunately, I'm not much of a coder either, but mc's ideas seem sound. I would probably look at replacing the quantity box code with the checkbox code. You also might look at the product info page code. If you have a minimum of 6 set for the product, the quantity box on the product info page will show 6.

27 Nov 2013, 11:50 PM
#10
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Checkbox instead of buy now button on all products page

Thanks, I'll be sure look at it before I start hacking.. :-)

27 Nov 2013, 11:53 PM
#11
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

stevesh:

I missed the checkbox part of your original question. Unfortunately, I'm not much of a coder either, but mc's ideas seem sound. I would probably look at replacing the quantity box code with the checkbox code. You also might look at the product info page code. If you have a minimum of 6 set for the product, the quantity box on the product info page will show 6.

The thing I'm concerned about is this. Okay, so check box is selected: how does customer know how many individual units of what is displayed they are going to "get". So not too big of an issue, but now they go to check out and where they "checked" once, they now have 6 items. If the product description said something like this is a group of six items, now it looks like they are getting 36 individuals and could cause confusion/cart dumping.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

28 Nov 2013, 12:08 AM
#12
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

The two "hard" parts I see at the moment is providing a checkbox instead of a text box on the correct page(s) and then parsing that information. Call me crazy to want to maintain existing functionality (perhaps switched so can return to routine function) developing an add-on feature rather than a site specific) to modify specifically for the site, ah not so hard.

Need to also be able to properly process a list where out of stock is present (assuming that it is displayed)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

28 Nov 2013, 12:16 AM
#13
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

The OP didn't say so, but I suspect this is a company's internal ordering site, rather than something that is available to the general public. That changes the whole dynamic.

28 Nov 2013, 12:21 AM
#14
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

stevesh:

The OP didn't say so, but I suspect this is a company's internal ordering site, rather than something that is available to the general public. That changes the whole dynamic.

whispered I agree, but think it could be a great feature available to more than the one company, especially considering what I thinnk I remember the application to be: mobile device. :) normal voice from experience in many areas (programming included) always best to consider future capability at the beginning rather than focusing on how to "patch" the solution. :) just a word of advice.

Never know when the "boss" says, I like that now what about... And either answering no (because now it's difficult) or banging one's head because initial view was so narrowly focused.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

28 Nov 2013, 12:24 AM
#15
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

Regardless, when I get in front of a computer, I think I might take a look at how this can be implemented.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

28 Nov 2013, 9:53 PM
#16
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Checkbox instead of buy now button on all products page

mc12345678 is absolutely right that this should be a made into a plugin and offered to the zc community. I am surprised it hasn't been implemented already.

If some one helps with/does the code I'll be glad to implement it and do lots of testing.

It will be a public site but only pre-approved, logged in customers will see pricing and be able to order.
We needed an extremely streamlined site "very tablet/mobile device friendly" for which the check boxes would be very nice. I am using the Numinix fec plugin.
About 99% done (without the Check Boxes)
Hope to be able to show it to you soon.

Thanks, Hope Y'all are having a GREAT Thanksgiving!

28 Nov 2013, 10:18 PM
#17
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

linuxguy2:

mc12345678 is absolutely right that this should be a made into a plugin and offered to the zc community. I am surprised it hasn't been implemented already.

If some one helps with/does the code I'll be glad to implement it and do lots of testing.

It will be a public site but only pre-approved, logged in customers will see pricing and be able to order.
We needed an extremely streamlined site "very tablet/mobile device friendly" for which the check boxes would be very nice. I am using the Numinix fec plugin.
About 99% done (without the Check Boxes)
Hope to be able to show it to you soon.

Thanks, Hope Y'all are having a GREAT Thanksgiving!

I thought I would have a chance last night to at least look at the code. Didn't get that far. :/

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

29 Nov 2013, 12:04 AM
#18
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

mc12345678:

I thought I would have a chance last night to at least look at the code. Didn't get that far. :/

Have a checkbox that has been populated with the minimum order quantity controlled by an admin setting in the all Listings configuration area. Working on processing the result(s) once add to cart is selected from the all listings area. Oh and dinner turkey is almost ready. :)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

29 Nov 2013, 12:19 AM
#19
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

Oh, you guys are going to "hate" this.... It really is as simple as providing a checkbox that is populated with the minimum quantity, and the rest of the code takes care of it... Wow, easy as pie... Mmm.. Pumpkin pie....

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

29 Nov 2013, 1:20 AM
#20
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Checkbox instead of buy now button on all products page

mc12345678:

Oh, you guys are going to "hate" this.... It really is as simple as providing a checkbox that is populated with the minimum quantity, and the rest of the code takes care of it... Wow, easy as pie... Mmm.. Pumpkin pie....

SQL to add setting:

INSERT INTO configuration (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `set_function`) VALUES ('Display Check Box for Checkout', 'PRODUCT_ALL_CHECKBOX_ACTIVE1', 'false', 'Setting this value to 1 will force a checkbox to be displayed so that when checked, the minimum quantity for the product will be added to the store.', '23', '26', NULL, NOW(), 'zen_cfg_select_option(array(\'0\', \'1\'),');

in includes/languages/YOUR_TEMPLATE/english.php at around line 569 (Search for multiple product add to cart) and then add:

  define('TEXT_PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART_CHECKBOX', 'Add Min Qty: ');

in shop/includes/modules/pages/products_all/header_php.php

search for: $products_all_query_raw =

(Which should be around line 23)
replace that line with:

/* Start Checkbox modification added p.products_quantity_order_min to query */
$products_all_query_raw = "SELECT p.products_type, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, " . (PRODUCT_ALL_CHECKBOX_ACTIVE ? "p.products_quantity_order_min, " : "") . "

Do not replace any lines past that.

Copy SHOP\includes\templates\template_default\templates\tpl_modules_products_all_listing.php to:

SHOP\includes\templates\YOUR_TEMPLATE\templates\tpl_modules_products_all_listing.php
Then at line 90 looking for: ```
if (PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0 && $products_all->fields['products_qty_box_status'] != 0) {


essentially replace that line with this:

/start Checkbox modification /
if (PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0 && $products_all->fields['products_qty_box_status'] != 0 && PRODUCT_ALL_CHECKBOX_ACTIVE) {
$link = TEXT_PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART_CHECKBOX . "(" . $products_all->fields['products_quantity_order_min'] . ") " . "<input type="checkbox" name="products_id[" . $products_all->fields['products_id'] . "]" value="". $products_all->fields['products_quantity_order_min'] . "" size="4" />";
} /else//
end Checkbox modification: had to add else to next statement
/elseif (PRODUCT_ALL_LISTING_MULTIPLE_ADD_TO_CART > 0 && $products_all->fields['products_qty_box_status'] != 0) {

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...