Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity Box in Products Listing App for Edge CS


freakystreak

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.

Link to comment
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
Link to comment
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.

Link to comment
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.

 

Link to comment
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....

Link to comment
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)));  
      }
	}

 

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...