Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding Unit Price to Cart


Guest

Recommended Posts

Since I use quantity discounts I needed to have the shopping_cart.php page show the unit price instead of just the product name and total for multiple quantities. Since this is far too simple to add as a contribution I figured I would just put it here. :?

 

In catalog/includes/languages/english/shopping_cart.php add the define:

 

define('TABLE_HEADING_EACH', 'Price Each');

 

In catalog/includes/modules/order_details.php find this:

 

  echo '<td align="right" class="tableHeading">' . TABLE_HEADING_TOTAL . '</td>';

 

Add this just before it:

  if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

   $colspan++;

 echo '<td align="right" class="tableHeading">' . TABLE_HEADING_EACH . '</td>';

 }

Find this:

 

// Tax (not in shopping cart, tax rate may be unknown)

 if (!strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

   echo '    <td align="center" valign="top" class="main">' . number_format($products[$i]['tax'], TAX_DECIMAL_PLACES) . '%</td>' . "n";

 }

 

Add this right after:

 

// Product Each Price

 if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

   echo '    <td align="right" valign="top" class="main"><b>' . $currencies->display_price($products[$i]['price'], $products[$i]['tax']) . '</b>' . "n";

 }

 

This works great with the Staffelpreis/quantity discounts which shows the proper unit price if the quantity is changed. Screenshots:

 

units1.jpg

 

units2.jpg

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

Updated codes for newer snapshots that no longer have the file order_details.php :D :

 

In catalog/includes/languages/english/shopping_cart.php add the define:

 

define('TABLE_HEADING_EACH', 'Price Each');

 

In catalog/shopping_cart.php find this around line 70:

 

 

    $info_box_contents[0][] = array('align' => 'center',

                                   'params' => 'class="productListing-heading"',

                                   'text' => TABLE_HEADING_QUANTITY);

 

Add this right after:

    $info_box_contents[0][] = array('align' => 'right',

                                   'params' => 'class="productListing-heading"',

                                   'text' => TABLE_HEADING_EACH);

 

Next in catalog/shopping_cart.php find this around line 148:

 

      $info_box_contents[$cur_row][] = array('align' => 'center',

                                            'params' => 'class="productListing-data" valign="top"',

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

 

Add this right after:

 

      $info_box_contents[$cur_row][] = array('align' => 'right',

                                            'params' => 'class="productListing-data" valign="top"',

                                            'text' => '<b>' . $currencies->display_price($products[$i]['price'], tep_get_tax_rate($products[$i]['tax_class_id'])) . '</b>');

 

HTH

Link to comment
Share on other sites

  • 2 years later...
Since I use quantity discounts I needed to have the shopping_cart.php page show the unit price instead of just the product name and total for multiple quantities. Since this is far too simple to add as a contribution I figured I would just put it here. :?

In catalog/includes/languages/english/shopping_cart.php add the define:

define('TABLE_HEADING_EACH', 'Price Each');

In catalog/includes/modules/order_details.php find this:

 ?echo '<td align="right" class="tableHeading">' . TABLE_HEADING_TOTAL . '</td>';

Add this just before it:

 ?if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

? ?$colspan++;

?echo '<td align="right" class="tableHeading">' . TABLE_HEADING_EACH . '</td>';

?}

Find this:

// Tax (not in shopping cart, tax rate may be unknown)

?if (!strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

? ?echo ' ? ?<td align="center" valign="top" class="main">' . number_format($products[$i]['tax'], TAX_DECIMAL_PLACES) . '%</td>' . "n";

?}

Add this right after:

// Product Each Price

?if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

? ?echo ' ? ?<td align="right" valign="top" class="main"><b>' . $currencies->display_price($products[$i]['price'], $products[$i]['tax']) . '</b>' . "n";

?}

This works great with the Staffelpreis/quantity discounts which shows the proper unit price if the quantity is changed. Screenshots:

units1.jpg

units2.jpg

;) I dont have this file in my directory:

In catalog/includes/modules/order_details.php !!!

Link to comment
Share on other sites

  • 3 weeks later...

Archived

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

×
×
  • Create New...