Post by markspeckman » Fri Jul 08, 2011 2:43 pm

Been staring at this for hours so I give up and am asking. :) I think I have most of what I need to get the quantity box working but it's not actually adding to the cart. I put this in category.tpl from product.tpl, changed it a bit:

Code: Select all

      
<div class="cart"><div>
  <a id="button-cart" class="button"><span><?php echo $button_cart; ?></span></a>
  <input type="text" name="quantity" size="2" value="1" />
  <input type="hidden" name="product_id" size="2" value="<?php echo $product['product_id']; ?>" />
</div></div>
and then I put the javascript button-cart from product.tpl in category.tpl too. Everything displays fine, it just doesn't do anything when I click.
I know it's going to be something stupid :) but I don't understand this code well enough yet, and I'm not that strong of a web coder. Do I need anything from the product.php file? I couldn't find anything that looked important.
Thanks,
mark

Newbie

Posts

Joined
Sat Jan 16, 2010 3:10 pm

Post by wonderland » Mon Jul 18, 2011 4:21 pm

I'm really trying to figure this out as well.

Have you had any luck ?

I did more or less the same thing as you did and I probably think it's something small, but I don't know what :(

New member

Posts

Joined
Wed Jun 15, 2011 8:25 pm

Post by markspeckman » Tue Jul 19, 2011 3:43 am

No, I haven't figured it out. I gave up and moved onto other things, and was really hoping that someone who knows what they're doing would make a module or a vqmod. I'll post here and let you know if I ever figure it out!

Newbie

Posts

Joined
Sat Jan 16, 2010 3:10 pm

Post by quocbinhvip » Tue Jul 19, 2011 6:42 pm

markspeckman wrote:Been staring at this for hours so I give up and am asking. :) I think I have most of what I need to get the quantity box working but it's not actually adding to the cart. I put this in category.tpl from product.tpl, changed it a bit:

Code: Select all

      
<div class="cart"><div>
  <a id="button-cart" class="button"><span><?php echo $button_cart; ?></span></a>
  <input type="text" name="quantity" size="2" value="1" />
  <input type="hidden" name="product_id" size="2" value="<?php echo $product['product_id']; ?>" />
</div></div>
and then I put the javascript button-cart from product.tpl in category.tpl too. Everything displays fine, it just doesn't do anything when I click.
I know it's going to be something stupid :) but I don't understand this code well enough yet, and I'm not that strong of a web coder. Do I need anything from the product.php file? I couldn't find anything that looked important.
Thanks,
mark
I also want to be like you

https://quocbinhvip.blogspot.com
https://sites.google.com/site/qbinh68/
https://sites.google.com/site/qbinh68/t ... t/opencart


New member

Posts

Joined
Sun Mar 20, 2011 3:58 pm

Post by wonderland » Thu Jul 28, 2011 6:30 pm

I think I might know why nothing happens when you press button.

Probably some piece of code needs to be copied from catalog/controller/product/poduct.php
to
catalog/controller/product/category.php

I'm trying to find it, but I'm not that smart when it comes to php

New member

Posts

Joined
Wed Jun 15, 2011 8:25 pm

Post by JIM2Y » Tue Aug 23, 2011 1:17 am

I WANT THIS TOO.

Newbie

Posts

Joined
Thu Aug 04, 2011 2:29 am

Post by gsdev » Sun Aug 28, 2011 4:36 pm

I need this too... Any idea's :D

Newbie

Posts

Joined
Wed Apr 06, 2011 8:45 pm

Post by JAZEE » Sun Aug 28, 2011 7:28 pm

Has anyone figured this out yet? if not then let me know, I'll see what i can do! In the mean time use photoshop to show me what you guys are trying to achieve!

Whatever I do, I'm usually successful at even though I started to learn PHP and javascript 3 months ago!
Cheers!

Newbie

Posts

Joined
Sat Dec 25, 2010 8:45 pm

Post by gsdev » Mon Aug 29, 2011 11:56 pm

Hi Jazee,

No, still haven't found the solution... and YES, still interested! What do you mean by 'show you on photoshop'??? I think the question is self explained ie: add a quantity box for each product in the category pages.

eg: product A has a price of 5€

for the moment you can just add product A to cart and the quantity will ALWAYS be ONE(1).

... we need (like in product) a quantity textbox before the 'buy' button to change the quantity (not only one) so that the amount in quantity of that product is added to cart when pressing the 'add to cart' button. Clear?

I've tried a few things but nothing works?!!! :(

Good luck and let us know if you find the solution.

Inspire the future

regards,

GSdev

Newbie

Posts

Joined
Wed Apr 06, 2011 8:45 pm

Post by celestial » Tue Aug 30, 2011 6:39 am


Celestial - Martín Abel Rosales
Email: martinrosales2012@hotmail.com
Skype: martin.abel.rosales
San José , Costa Rica


User avatar
Expert Member

Posts

Joined
Sat Mar 20, 2010 4:19 am
Location - Costa Rica

Post by gsdev » Tue Aug 30, 2011 6:16 pm

thank-you Celestial... it works :-))) mod on my 1.4.9.3 with slight change and all OK.

works on later versions too.

for those on 1.4.9.3...

change on first modification line in link:
$this->data['action'] = $this->url->link('checkout/cart');
to:
$this->data['action'] = HTTPS_SERVER . 'index.php?route=checkout/cart';

... and the rest works fine.

cheers

Newbie

Posts

Joined
Wed Apr 06, 2011 8:45 pm

Post by celestial » Tue Aug 30, 2011 10:00 pm

gsdev wrote:thank-you Celestial... it works :-))) mod on my 1.4.9.3 with slight change and all OK.

works on later versions too.

for those on 1.4.9.3...

change on first modification line in link:
$this->data['action'] = $this->url->link('checkout/cart');
to:
$this->data['action'] = HTTPS_SERVER . 'index.php?route=checkout/cart';

... and the rest works fine.

cheers
Hi all, is good hear this, you can translate all the procedure for the english people and can explain yours slight changes, please?? if you read the full post i make a question, how make to work with options (go to the product page for choose the options if have, if not add to the cart). Thanks.

Celestial - Martín Abel Rosales
Email: martinrosales2012@hotmail.com
Skype: martin.abel.rosales
San José , Costa Rica


User avatar
Expert Member

Posts

Joined
Sat Mar 20, 2010 4:19 am
Location - Costa Rica

Post by michaelsen » Sat Sep 24, 2011 3:39 am

Thanks Celestial. It works well.
I will make a db query to products_option and check if there are any options for that product_id. If there is then I serve the original OC code so the user is redirected to the product page through a "more info" button.

Is there any way to change your code so the user will stay on the category page instead of being redirected to the shopping cart every time he add a product??

New member

Posts

Joined
Tue May 03, 2011 3:17 am

Post by AVAR » Sun Jul 14, 2013 6:57 am

it is not working with me
1.5.5.1

New member

Posts

Joined
Wed Jul 10, 2013 8:49 pm
Who is online

Users browsing this forum: No registered users and 9 guests