Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shopping Cart Error


gemanda

Recommended Posts

I've installed both QTPro and Actual Attribute Price for our store, and am having a problem with the main shopping_cart.php.

 

The total calculates correctly. However, for each product line item, if it has multiple attributes (e.g., size & color), the price for that line item shows as either zero or negative (the color is the second attribute selected, and it has no price).

 

Looking at shopping_cart.php, I've put in various code to no avail. My problem seems to be right here (line 157 for me).

 

$info_box_contents[$cur_row][] = array('align' => 'right', 'params' => 'class="productListing-data" valign="top"', 'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');

 

I have no idea where this "display_price($products[$i]['final_price']" comes from in order to edit it properly.

 

Any ideas?

Link to comment
Share on other sites

I have no idea where this "display_price($products[$i]['final_price']" comes from in order to edit it properly.

I have no idea where this "display_price($products[$i]['final_price']" comes from in order to edit it properly. 

 

That function is in ./include/classes/currencies.php if that helps any.

 

Eric

Link to comment
Share on other sites

Are you pricing by size or by product plus size diffential. For example

 

Product Shirt - no price

attribute size - price

attribute color - no price

 

or

 

Product shirt - X price

attribute size - Add Y price to X price

attribute color - no price

 

$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {

$this->products[$index] = array('qty' => $orders_products['products_quantity'],

'id' => $orders_products['products_id'],

'name' => $orders_products['products_name'],

'model' => $orders_products['products_model'],

'tax' => $orders_products['products_tax'],

'price' => $orders_products['products_price'],

'final_price' => $orders_products['final_price']);

 

$subindex = 0;

$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");

if (tep_db_num_rows($attributes_query)) {

while ($attributes = tep_db_fetch_array($attributes_query)) {

$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],

'value' => $attributes['products_options_values'],

'prefix' => $attributes['price_prefix'],

'price' => $attributes['options_values_price']);

 

$subindex++;

}

}

 

$this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';

 

$index++;

}

}

found this in catalog/includes/classes/order.php

Link to comment
Share on other sites

I would use Master Products rather than the QTPro/Actual Attribute Price combination. YMMV.

 

In regards to your problem, if it helps, the 'final_price' is set in the get_products function of the shopping_cart class.

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Mac-E Thanks, I'll go diving in there and see what I find.

 

bloodshoteyes I'm using the first option, pricing by size. And that code is interesting...I'm just not sure how it applies to what I have. Forgive me for being dense--I've had a horrible stomach bug for the last 36 hours, so I'm not thinking too clearly. But the actual order is calculating correctly...when I look at the total in either the info box or the cart page, everything's fine. It's the individual line items that are a problem.

 

ecartz Thanks for the advice. I checked out Master Products, but it really doesn't fit the type of situation I have. In addition, I don't want each size listed as an individual product...I want the product with the sizes. It's just me being picky...I'm trying to gain every edge on competitors, and they all have the product for each size, which many people complain is very confusing. ;)

Link to comment
Share on other sites

Ok...the solution if anyone comes back to this thread in a search...

 

The update to Actual Attributes Price added 3/3/04 both fixed and broke my code.

 

I had to comment out this code in the classes/shopping_cart.php in the latest version of the contribution. For me, it was lines 257-262.

 

if ($price_prefix == '')
{  if ($attribute_price['options_values_price'] == '0')
        $this->total += tep_add_tax($products_price, $products_tax) * $qty;
}

 

This if statement caused my product price to be doubled for the order total. So if an item for $14 was added to the cart, the item's line showed correctly at $14, but the cart's total was $28.

 

Other than that, the newest addition to the contribution worked great and fixed my line item problem!

Link to comment
Share on other sites

I checked out Master Products, but it really doesn't fit the type of situation I have.  In addition, I don't want each size listed as an individual product...I want the product with the sizes.  It's just me being picky...I'm trying to gain every edge on competitors, and they all have the product for each size, which many people complain is very confusing.  ;)
Master Products displays as

 

Master Product w/description

 

Size 1 w/ price and quantity selector

Size 2

Size 3

 

Not as separate products (although it stores as separate products on the back end). It is your option if the slave products will display separately.

 

If the other solution is working for you, that's great, no need to make changes. However, I think that in general, Master Products is a better fit for your type of needs than the mix of the other two contributions. In fact, it was designed for exactly that kind of issue.

 

Hth,

Matt

Always back up before making changes.

Link to comment
Share on other sites

Hmmm...you may be right, Matt. I didn't realize Master Products allows you to display only the master on the page... I'm starting to wonder if the QTPro/AAP combo is going to work for me, esp since I'm trying to implement the Quickbooks contribution.

 

Will Master Products allow me to have two attributes for a product, both color & size?

 

Looks like I need to do some more research!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...