The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

What I did to remove "Quantity"

chriscoyierchriscoyier Member
in Bugs & Feature Requests edited August 2008
In the cart template, I added a little CSS:
<style type="text/css">
#fc_cart_table thead th#fc_cart_head_quantity { color: #666666; }
input.fc_cart_item_quantity { display: none; }
</style>

Changing the color of the "Quantity" text seemed easiest to "hide" it, because setting it to display: none; was problematic in shortening that whole top bar. The input, however, was "hideable".

Then, for each product, I just put in a maximum quantity of one, which should prevent that quantity from incrementing even if people close the cart and add the same product to the cart to open it again (which by default ups the quantity)
<input type="hidden" name="quantity_max" value="1" />

Does this seem solid? Is there any problems with this?
Comments
  • brettbrett FoxyCart Team
    Ah... interesting about hiding the color. We should add a span wrapper in there to allow you a bit more flexibility. Thanks for bringing that up.

    You may need to hide the [x] text as well. It's a separate span, next to the input.

    Thanks for posting this Chris! I'm sure it'll come in handy to others down the road.
  • I wonder if it's possible to hide the quantity only for items whose quantiyy_max=1, or for certain categories only.
  • lukeluke FoxyCart Team
    drwagner, I've done things similar for a friend's site I was helping out with. In that case, I was checking the product name in the json object on page load in the cart template and then adjusting things from there via JQuery.

    Check it out: http://www.modernash.com

    I looped through the JSON to find the index of the item I was looking for and then just removed the quantity input completely and replaced it with a hidden input.
    $j("#quantity"+shippingCostIndex).parent().siblings("td.fc_cart_item_price").children("span.fc_cart_item_price_each").hide();
    $j("#quantity"+shippingCostIndex).parent().html('<input type="hidden" id="quantity'+shippingCostIndex+'" name="quantity'+shippingCostIndex+'" value="1">');	
    

    There's a lot of other really interesting stuff going on there to calculate shipping and delivery service charges based on zip code. Pretty cool stuff.

    That may not be exactly what you want to do, but it's one way to go. You should be able to do the same thing by checking the category in 0.4.0 json. You could also just adjust the CSS based on the category via JQuery as well.
Sign In or Register to comment.