Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cart help:(


helpme:(

Recommended Posts

Posted

Ok. I have looked through out the forum and can't seem to find what I am looking for. I even tried google to see if anyone else was trying to do the same thing that I'm trying to accomplish, but had no luck. Guess it's just me.

 

I am trying to edit the shopping cart so that you can not change to quantity. The items being sold are unique items so customers can't really buy more than one. So, my question is: Is there a way to disable the quantity box from being edited.

 

- I need the shopping cart to display quantity 1 and that's it.

- Need an "empty entire cart" link in shopping cart.

 

 

If someone could help me I would greatly appreciate it.

Posted

find in includes/classes/shopping_cart.php

    function update_quantity($products_id, $quantity = '', $attributes = '') {
     global $customer_id;

add after the above code:

//if (empty($quantity)) return true;
if (empty($quantity) || !is_numeric($quantity)) return true;
$quantity = (int)($quantity);

$stock_quantity_qry = tep_db_query("select products.products_quantity from " . TABLE_PRODUCTS . " where products.products_id =" . tep_get_prid($products_id));
$stock_quantity = tep_db_fetch_array($stock_quantity_qry);

if ($quantity > $stock_quantity[products_quantity]) $quantity = $stock_quantity[products_quantity];

 

when done, the customer can not order more than what is on stock

Posted

peter222 thanks for the help. Kind of what i was looking for.

 

Do you know how to remove the box that the "1" is in?

Posted

if your stock is 1

 

shopping_cart will display 1 (people can edit the amount, outcome will be 1)

 

after using the code in my former post

 

or am i missing your point? :)

Posted

Sorry to sound unappreciated. I do appreciate your help :D. What I am look for is....

 

here is a illustration. Hope you can help me.

 

 

cart.gif

 

 

The cart to the left you can see the text "1" in a box I would like i to appear like the cart to the right, just text.

Posted

ok you just want to get rid of the editable amount box all together; should not be a problem

 

problem is, i'm off to bed, back tomorrow :)

Posted

I have a similar issue: The quantity on my order summary / invoice / packing slip does not show. Customers have the potential to order more than just 1 of all my products, but if they do, I'll have no way of seeing it, as there is nothing before the "x (product name)".

 

Any help with this? I have checked with original files and the code all seems fine. Very frustrating!

Posted

@ helpme:(

 

i misread your request, i already wrote a complete post how to, then something clicked: you do not want to get rid of the box AND qty, just the box.. d*mn, lost some of my precious time :P

anyway, this should do it.

 

find in catalog/shopping_cart.php:

'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

replace with:

'text'=>  $products[$i]['quantity'] . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...