Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display MSRP & Savings (wdepot, 22 Sep 2005)


jonquil

Recommended Posts

Title says it all, almost :) Display MSRP & Savings

 

After completing 99% of the instructions, I am blind wading through all the modifications made by someone else. I have read through all posts on MSRP and can't see this addressed elsewhere.

 

Would someone rescue me and help integrate the following step into catalog/product_info.php? I will be more than grateful :)

 

jon

 

Step from MSRP_listing.txt (6a. In catalog/product_info.php):

 

[b]Find:[/b]

   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
     $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
   } else {
     $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
   }

[b]and change it to read:[/b]

           $products_price = '<table class="PriceList" border="0" width="100%" cellspacing="0" cellpadding="0">';
           $new_price = tep_get_products_special_price($product_info['products_id']);
           if ($product_info['products_msrp'] > $product_info['products_price'])
             $products_price .= '<tr><td>' . TEXT_PRODUCTS_MSRP . '</td><td class="oldPrice" align=right>' . $currencies->display_price($product_info['products_msrp'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';
           $products_price .= '<tr><td>' . TEXT_PRODUCTS_OUR_PRICE . '</td>';
           if ($new_price != '')
             {$products_price .= '<td class="oldPrice"';}
           else
             {$products_price .= '<td';}
           $products_price .= ' align=right>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';
           if ($new_price != '')
             {$products_price .= '<tr class="productSpecialPrice"><td>' . TEXT_PRODUCTS_SALE . '</td><td align=right>' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}
           if ($product_info['products_msrp'] > $product_info['products_price'])
             {if ($new_price != '')
               {$products_price .= '<tr><td>' . TEXT_PRODUCTS_SAVINGS . '</td><td align=right>' . $currencies->display_price(($product_info['products_msrp'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}
             else
               {$products_price .= '<tr><td>' . TEXT_PRODUCTS_SAVINGS . '</td><td align=right>' . $currencies->display_price(($product_info['products_msrp'] -  $product_info['products_price']), tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}}
           else
             {if ($new_price != '')
               {$products_price .= '<tr><td>' . TEXT_PRODUCTS_SAVINGS . '</td><td align=right>' . $currencies->display_price(($product_info['products_price'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}}
           $products_price .= '</table>';

 

Existing catalog/product_info.php chunk:

 

     $product_info = tep_db_fetch_array($product_info_query);

  tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

  if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

// BOF Separate Price per Customer
    $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
    if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
    $product_info['products_price']= $scustomer_group_price['customers_group_price'];
}
$products_price = '';
 if ($customer_group_id != '0') {
 $products_price .= '<span class="boxText">' . SHOW_PRICE_LIST;
 $products_price .= $currencies->display_price($product_info['list_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
 $products_price .= '</span><br>'; // customer group prices on the next line end of small text for retail prices
}
 $products_price .= '<span class="boxText">' . REGULAR_PRICE;
    $products_price .= '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s><BR>' . SPECIAL_PRICE . '<span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
// EOF Separate Price per Customer

  } else {

// BOF Separate Price per Customer
      $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
      if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
      $product_info['products_price']= $scustomer_group_price['customers_group_price'];
}
$products_price = '';
 if ($customer_group_id != '0') {
 $products_price = '<span class="boxText">' . SHOW_PRICE_LIST;
 $products_price .= $currencies->display_price($product_info['list_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
 $products_price .= '</span><br>'; // customer group prices on the next line end of small text for retail prices
}
    $products_price .= SHOW_YOUR_PRICE ;
    $products_price .= $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
// EOF Separate Price per Customer

  }
// EOF Show Price list v.3.5 1.0 for SPPC 4.1

   if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];
   }
?>
     <tr>
       <td>
<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>
           <td class="pageHeading" width="70%" valign="top"><?php echo $products_name; ?></td>
           <td class="pageHeading" width="30%" align="right" valign="top"><?php echo $products_price; ?></td>
           </tr><tr>
           <td colspan="2" width="100%"><?php echo tep_draw_separator('pixel_trans.gif', '10', '5'); ?></td>
</tr></table>
       </td>
     </tr>
     <tr>
       <td class="main">

<!-- // Begin Tabbed Content //-->

It's all just ones and zeros....

Link to comment
Share on other sites

Resolved myself after a few cuppas and some sleep. Code chunk below posted to help others having same/similar issue.

 

jon

 

catalog/products_info.php

     $product_info = tep_db_fetch_array($product_info_query);

  tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

  if ($new_price = tep_get_products_special_price($product_info['products_id'])) { [b]// LEAVE IN FOR MSRP- DO NOT REPLACE[/b]

// BOF Separate Price per Customer
    $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
    if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
    $product_info['products_price']= $scustomer_group_price['customers_group_price'];
}
$products_price = '';
 if ($customer_group_id != '0') {
 $products_price .= '<span class="boxText">' . SHOW_PRICE_LIST;
 $products_price .= $currencies->display_price($product_info['list_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
 $products_price .= '</span><br>'; // customer group prices on the next line end of small text for retail prices
}
 $products_price .= '<span class="boxText">' . REGULAR_PRICE;
    $products_price .= '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s><BR>' . SPECIAL_PRICE . '<span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
// EOF Separate Price per Customer

  } else {

// BOF Separate Price per Customer
      $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
      if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
      $product_info['products_price']= $scustomer_group_price['customers_group_price'];
}
$products_price = '';
 if ($customer_group_id != '0') {
 $products_price = '<span class="boxText">' . SHOW_PRICE_LIST;
 $products_price .= $currencies->display_price($product_info['list_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
 $products_price .= '</span><br>'; // customer group prices on the next line end of small text for retail prices
}
    $products_price .= SHOW_YOUR_PRICE ;
    $products_price .= $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
// EOF Separate Price per Customer

  }
// EOF Show Price list v.3.5 1.0 for SPPC 4.1

   if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];
   }
[b]// BOF MSRP
[/b]			$products_price = '<table class="PriceList" border="0" width="100%" cellspacing="0" cellpadding="0">';
           $new_price = tep_get_products_special_price($product_info['products_id']);
           if ($product_info['products_msrp'] > $product_info['products_price'])
             $products_price .= '<tr><td>' . TEXT_PRODUCTS_MSRP . '</td><td class="oldPrice" align=right>' . $currencies->display_price($product_info['products_msrp'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';
           $products_price .= '<tr><td>' . TEXT_PRODUCTS_OUR_PRICE . '</td>';
           if ($new_price != '')
             {$products_price .= '<td class="oldPrice"';}
           else
             {$products_price .= '<td';}
           $products_price .= ' align=right>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';
           if ($new_price != '')
             {$products_price .= '<tr class="productSpecialPrice"><td>' . TEXT_PRODUCTS_SALE . '</td><td align=right>' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}
           if ($product_info['products_msrp'] > $product_info['products_price'])
             {if ($new_price != '')
               {$products_price .= '<tr><td>' . TEXT_PRODUCTS_SAVINGS . '</td><td align=right>' . $currencies->display_price(($product_info['products_msrp'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}
             else
               {$products_price .= '<tr><td>' . TEXT_PRODUCTS_SAVINGS . '</td><td align=right>' . $currencies->display_price(($product_info['products_msrp'] -  $product_info['products_price']), tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}}
           else
             {if ($new_price != '')
               {$products_price .= '<tr><td>' . TEXT_PRODUCTS_SAVINGS . '</td><td align=right>' . $currencies->display_price(($product_info['products_price'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}}
           $products_price .= '</table>';
[b]// EOF MSRP[/b]
?>
     <tr>
       <td>
<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>
           <td class="pageHeading" width="70%" valign="top"><?php echo $products_name; ?></td>
           <td class="pageHeading" width="30%" align="right" valign="top"><?php echo $products_price; ?></td>
           </tr><tr>
           <td colspan="2" width="100%"><?php echo tep_draw_separator('pixel_trans.gif', '10', '5'); ?></td>
</tr></table>
       </td>
     </tr>
     <tr>
       <td class="main">

<!-- // Begin Tabbed Content //-->

It's all just ones and zeros....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...