Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Help Requested on two price in two currency

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-06-2006, 09:07 AM
 
salsabeel salsabeel is offline
 

Senior Member
  
Join Date: Jan 2004
Posts: 132
 

Default Help Requested on two price in two currency

Hello everyone,



I am trying to create a custom mod for show second price in anther currency.

No automatic calculation: every product must have 2 fields (Price in US Dollar. USD and price in Egyptian Pound. EGP).
Product must have one price in EUR, and can have price in EGP or not.
No change in ordering currency.
Add two currencies to product.tpl, products.tpl and cart_totals.tpl.
Calculate total price for all products in cart with two currencies.


Below are the steps I have done.



1- Add new field called (price_eg) in SQL table (xcart_pricing) from phpMyAdmin
`price_eg` decimal(12,2) NOT NULL default '0.00'

2- Add second price to product array as follow
in func.php modify
Code:
$product = func_query_first("SELECT $sql_tbl[products].*, $sql_tbl[products].avail-$in_cart AS avail, min($sql_tbl[pricing].price) AS price $add_fields FROM $sql_tbl[products], $sql_tbl[pricing] $join WHERE $sql_tbl[products].productid='$id' ".$login_condition." AND $sql_tbl[pricing].productid=$sql_tbl[products].productid AND $sql_tbl[pricing].quantity=1 AND $sql_tbl[pricing].variantid = 0 AND ($sql_tbl[pricing].membership = '".addslashes($membership)."' OR $sql_tbl[pricing].membership = '') GROUP BY $sql_tbl[products].productid");
To
Code:
$product = func_query_first("SELECT $sql_tbl[products].*, $sql_tbl[products].avail-$in_cart AS avail, min($sql_tbl[pricing].price) AS price, min($sql_tbl[pricing].price_eg) AS price_eg $add_fields FROM $sql_tbl[products], $sql_tbl[pricing] $join WHERE $sql_tbl[products].productid='$id' ".$login_condition." AND $sql_tbl[pricing].productid=$sql_tbl[products].productid AND $sql_tbl[pricing].quantity=1 AND $sql_tbl[pricing].variantid = 0 AND ($sql_tbl[pricing].membership = '".addslashes($membership)."' OR $sql_tbl[pricing].membership = '') GROUP BY $sql_tbl[products].productid");
And
Code:
$products_array = func_query_first("select $sql_tbl[products].*, min($sql_tbl[pricing].price) as price from $sql_tbl[products], $sql_tbl[pricing] where $sql_tbl[pricing].productid=$sql_tbl[products].productid and $sql_tbl[products].productid='$productid' and $avail_condition $sql_tbl[pricing].quantity<=$amount and ($sql_tbl[pricing].membership='".addslashes($membership)."' or $sql_tbl[pricing].membership='') AND $sql_tbl[products].forsale != 'N' AND $sql_tbl[pricing].variantid = 0 group by $sql_tbl[products].productid order by $sql_tbl[pricing].quantity desc");
To
Code:
$products_array = func_query_first("select $sql_tbl[products].*, min($sql_tbl[pricing].price) as price, min($sql_tbl[pricing].price_eg) AS price_eg from $sql_tbl[products], $sql_tbl[pricing] where $sql_tbl[pricing].productid=$sql_tbl[products].productid and $sql_tbl[products].productid='$productid' and $avail_condition $sql_tbl[pricing].quantity<=$amount and ($sql_tbl[pricing].membership='".addslashes($membership)."' or $sql_tbl[pricing].membership='') AND $sql_tbl[products].forsale != 'N' AND $sql_tbl[pricing].variantid = 0 group by $sql_tbl[products].productid order by $sql_tbl[pricing].quantity desc");

3- Add min($sql_tbl[pricing].price_eg) AS price_eg to all query in (search.php)
that contain min($sql_tbl[pricing].price) as price

4- At suitable place in (product.tpl) add
Code:
In Egypt:{include file="currency.tpl" value=$product.price_eg} {include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.price_eg}
And At (products.tpl) add
Code:
<FONT class="ProductPrice">In Egypt: {include file="currency.tpl" value=$products[product].price_eg}</FONT>
I have problem when I try to calculate total price for all products in cart with second currency , I know I must do this from changing at (func.php)
I tray to do this but I can't reach to what I want.

Any help that can be offered is greatly appreciated! If what I am asking is not clear just let me know and I will try to further explain. Thanks in advanced!
__________________
X-Cart Platinum 4.6.5
Reply With Quote
  #2  
Old 11-07-2006, 07:39 PM
 
salsabeel salsabeel is offline
 

Senior Member
  
Join Date: Jan 2004
Posts: 132
 

Default Re: Help Requested on two price in two currency

please, can any one help me.
Just I want to calculate total price for all products in cart with new price (price_eg),
please, give me any tips for this
__________________
X-Cart Platinum 4.6.5
Reply With Quote
  #3  
Old 11-12-2006, 07:58 AM
 
salsabeel salsabeel is offline
 

Senior Member
  
Join Date: Jan 2004
Posts: 132
 

Default Re: Help Requested on two price in two currency

please, can any one help me.
Am I need to change any thing in cart.php
__________________
X-Cart Platinum 4.6.5
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:21 AM.

   

 
X-Cart forums © 2001-2020