You must be logged in to post


Register? | Lost Your Password?

Search Forums:


 






Wildcard Usage:
*    matches any number of characters
%    matches exactly one character

How to add a quantity selection box to the product details page

UserPost

3:27 pm
January 6, 2010


Market Admin

Admin

posts 4756

1

Some of you may want to offer your customers the ability to add more than 1 item at a time to their shopping carts.

Here's a quick code modification that'll let you do that. 

(At the time of this writing, Market is at version 3.62)

Here's what to do:

In the Market theme file "single.php" you need a code change.

On or around line #181 you'll see the line:

      <input type="hidden" name="quantity" value="1">

You'll need to remove that line.

Then, somewhere else you'll need to add the following type of code to insert an input "text" field, rather than a hidden field:

      <input type="text" name="quantity" value="1" size="4">

So if you want, you can add this code on or around line #269

<tr><td><br/>Quantity: <input type="text" name="quantity" value="1" size="4"></td></tr>

Insert it right before:

      </table>  
<?php if($mkt_outstock != 1) { ?>   

That'll insert the correct code, along with some style formatting that'll make it show up decent.

3:18 am
February 13, 2011


Piper1

Florence

Member

posts 16

2

I SERIOUSLY SCREWED UP MY SITE ATTEMPTING THIS…I followed the steps above and somehow I shut down all of the visibility for my posts.  I think I screwed up on or around line 269 when I put in the new code and then removed it when it didn't work.  Could someone please get me the correct code to replace the entire single.php file?  I have the 4.1 Market Theme maybe that is why this didn't work.  Of course I have only had two to three other attempts at editing  and adding code, those ones worked this one didn't but I did notice you were using it on an earlier version…HELP ME PLEASEFrown

I can't believe how much I am learning from all the mistakes I make…Piper1

4:47 am
February 13, 2011


Piper1

Florence

Member

posts 16

3

I also clicked on the filter button accidently while I was going back and forth, could I have shut down all my posts this way?  I think the best thing is if you just copy all of the current single.php code for me and let me delete whatever mess I have in there no and replace it with the origional version before I tried to get tricky. 

I can't believe how much I am learning from all the mistakes I make…Piper1

1:42 pm
February 14, 2011


Market Admin

Admin

posts 4756

4

Just grab a new copy from the download center.  All versions are included there.

I know you probably don't need the reminder, but for those others reading — when making custom changes, ALWAYS hold onto a backup copy of the file before you start changing stuff.

We've all learned the hard way.

 

As far as the code changes above, I don't see any reason why they wouldn't work with version 4.1.

Make sure you've got all of the quotes entered properly.

 

The last part isn't on the same line anymore — it's around line #263 and now needs to go right before:

</table>  
<?php if($mkt_options['mkt_checkout_button'] != "none") {
          if($mkt_outstock != 1) { ?> 

8:07 pm
March 8, 2011


trendy

Port Chester NY

Member

posts 5

5

Hie,

 

What if i want the quantity selection box to be a drop down box? Can you please help me with the code for this?

 

Thanks

 

Susan

12:03 pm
March 9, 2011


Market Admin

Admin

posts 4756

6

Hi Susan,

Please post future questions in the "Support" forum. The "How to" forum is reserved for finished stuff. It's more of an "instructions" area, versus a "question" area.

Maybe this post will help you:
http://www.markettheme.com/for…..-drop-down



 

Market takes e-commerce to the next level with an easy to use, quick setup platform. Learn more or take the tour.