Jump to content
Latest News: (loading..)
freakystreak

Quantity Box in Products Listing App for Edge CS

Recommended Posts

Has anyone any knowledge if there is an addon or code to add a quantity box to the product_listing page in 2.3.4.1 Edge CE? I've searched through the apps but can't find one that works with this version OSC. Also, where had the case 'buy_now'  funtions gone from application_top.php? I know they are now modular but where have they gone?  Cheers


Ah, the world wide web. What a wonderful place.

Share this post


Link to post
Share on other sites
  1. Qty box on product listing would not work without either;
    a.  recoding to add in a form for each product
    or
    b.  javascript trickery (which would be foolhardy)
     
  2. log into admin, then go modules > actions
    this page will show all actions and where they are located

This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

I'm surprised this isn't already built in to be fair as majority of online stores have this feature.


Ah, the world wide web. What a wonderful place.

Share this post


Link to post
Share on other sites
22 minutes ago, JcMagpie said:

Take a look at this thread it may be of some help.

 

Cheers for the suggestion but I saw this before but it's coded for Edge before application_top became modular. Is there a way to adapt this to work on the latest and most current version? I can have products without attributes as I know this causes issues. I'm sure someone must have done it.

Edited by freakystreak

Ah, the world wide web. What a wonderful place.

Share this post


Link to post
Share on other sites
32 minutes ago, freakystreak said:

Edge before application_top became modular

That would be a question for one of the developer, But I would imagin most of the code you need is in shopping_cart.php as it makes use of this. Then its should just be a case of moving that to the section you need it to be in.


 

Share this post


Link to post
Share on other sites

@freakystreak the correct way to do this is move the changes mentioned in application_top into a NEW action module - specifically create a new action module (you could use the buy_now action module as a start) renamed name it say "buy_now_form" integrating @Tsimi changes

The changes to the product_listing would be the same....

Share this post


Link to post
Share on other sites

You could "test" this (I have NOT tested this).... upload to includes/actions/buy_now_forms.php

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2018 osCommerce

  Released under the GNU General Public License
*/
	
	class osC_Actions_buy_now_form {
		public static function execute() {
			global $PHP_SELF, $messageStack, $cart, $goto, $parameters;
      
			if (isset($_POST['products_id'])) {
                               $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id']))+($_POST['cart_quantity']), $_POST['id']);
                               }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));  
      }
	}

 

Share this post


Link to post
Share on other sites

OK, so I've tried what you suggested @greasemonkeyand it does indeed add the products to the cart but I get this error. 

Quote

Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\osc-edge\includes\actions\buy_now_form.php

this is the code that is producing the error

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

If I remove the above code, products are added to the cart but  the quantity boxes of each product after refresh have the same quantity  number set that was used to add to the cart. For instance, add a quantity of 2 for one product then when the page refreshes after the items are added to the cart, each product has a default quantity of 2 in the box.

I'm nearly there with this so I would greatly appreciate any advise or suggestions on how to fix this. 


Ah, the world wide web. What a wonderful place.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×