Jump to content

Save = Sale Price ?


Guest

Recommended Posts

I´m a total noob concerning mySQL and PHP, well lots of other things too.

Installed and got things running and noticed that Save is showing Sale_price and not Price - Sale_Price.

I really don´t understand queries, but this line in saleItems.inc.php seems OK to me.

$saleItems = $db->select("SELECT name, productId, price, sale_price, price - sale_price as saving FROM ".$config['dbprefix']."CubeCart_inventory ORDER BY saving ASC",$config['noSaleBoxItems']);

somehow saving is 6.99 even though it should be 10 - 6.99 = 3.01

It gets worse.

Added a new product same problem, but what´s worse is that all listed Sale Items get Save XXXX from the product showing in the main window.

Sale Items

Test Product

Save $995.00

Royal 500

Save $995.00

and if I switch to Test Product

Sale Items

Test Product

Save $6.99

Royal 500

Save $6.99

It should be

Sale Items

Test Product

Save $3.01

Royal 500

Save $200.00

Link to comment
Share on other sites

I changed the where clause in the select statement

and the saving amount section below

<?php

/*

+--------------------------------------------------------------------------

| CubeCart v3.0.0 Beta

| ========================================

| by Alistair Brookbanks

| CubeCart is a Trade Mark of Devellion Limited

| © 2005 Devellion Limited

| Devellion Limited,

| Westfield Lodge,

| Westland Green,

| Little Hadham,

| Nr Ware, HERTS.

| SG11 2AL

| UNITED KINGDOM

| http://www.devellion.com

| UK Private Limited Company No. 5323904

| ========================================

| Web: http://www.cubecart.com

| Date: Friday, 15 April 2005

| Email: [email protected]

| License Type: CubeCart is NOT Open Source Software and Limitations Apply

| Licence Info: http://www.cubecart.com/site/faq/license.php

+--------------------------------------------------------------------------

| saleItems.inc.php

| ========================================

| Sales Items Box

+--------------------------------------------------------------------------

*/

// query database *** add where clause

$saleItems = $db->select("SELECT name, productId, price, sale_price, price - sale_price as saving FROM ".$config['dbprefix']."CubeCart_inventory where sale_price > 0 ORDER BY saving ASC",$config['noSaleBoxItems']);

if($saleItems == TRUE && $config['saleMode']>0){

$box_content=new XTemplate ("skins/".$config['skinDir']."/styleTemplates/boxes/saleItems.tpl");

$box_content->assign("LANG_SALE_ITEMS_TITLE",$lang['front']['boxes']['sale_items']);

for($i=0;$i<count($saleItems);$i++){

if(($val = prodAltLang($saleItems[$i]['productId'])) == TRUE){

$saleItems[$i]['name'] = $val['name'];

}

$box_content->assign("DATA",$saleItems[$i]);

//$box_content->assign("SAVING",priceFormat($salePrice));

// *** changed here

if ($saleItems[$i]['sale_price'] > 0) {

$box_content->assign("SAVING",priceFormat($saleItems[$i]['saving']));

} else {

$box_content->assign("SAVING",priceFormat(0));

}

$box_content->assign("LANG_SAVE",$lang['front']['boxes']['save']);

$box_content->parse("sale_items.li");

} // end loop

$box_content->parse("sale_items");

$box_content = $box_content->text("sale_items");

} else {

$box_content = "";

}

?>

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
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...