xyncro Posted July 2, 2005 Share Posted July 2, 2005 ... i've tryed both with and without tax/vat when testing the tax/vat settings... and on both occasions it didn't show anything else then n/a... ..so what's going on...?? now correct me if i'm wrong but shouldn't the tax be visible for the customer during they session so that they won't get a surprice when they checkout..??? (not that the tax/vat makes a big difference in payment).. but anyway.... thx... Quote Link to comment Share on other sites More sharing options...
Guest strawberryfusion Posted July 3, 2005 Share Posted July 3, 2005 Hi, Under General Settings > Locale Settings have you tried changing the field: Include tax in prices? rajiv Quote Link to comment Share on other sites More sharing options...
xyncro Posted July 3, 2005 Author Share Posted July 3, 2005 .... thx strawberryfusion for your reply.. ..iv'e done that but it's more complicated than that.. i've even been in contact with brooky about this (through flyspray - i opened a task about this - and he said it's solved.. ).. where and how i don't know... ..in sweden we MUST show prices WITH tax and in some cases (like in this webstore) the tax specified right beside... MUST, MUST, MUST - those are the rules... so the obvious thing would be to set the setting in admin section to "No" not include tax, then the tax will only be SHOWN.. now.. if i do this tax will be added anyway to the grandtotal price which is WRONG mostly because the products are already included WITH TAX when added to the store, so no need to add it twice.. (i wonder what the customer will say if they knew).. but hey.. the tax is shown - and that's one of the rules... that's for starters... now second... i searched files to see if i could remove the xtra tax that is being added to the grandtotal which i explained above, and yes, i think i found it... in includes/content > cart.inc.php on line 565.. this >> $grandTotal = $subTotal + $tax + $shipCost; i changed to this >> $grandTotal = $subTotal + $shipCost; and pooow, i had a successful grandtotal WITHOUT XTRA tax... (the settings in admin are still set to "No" no tax included - which is good - it should (read must) only be shown) ...this small operation was successful, BUT ONLY when i have 1 product in the basket, if i have 2 or more the diplayed tax will come out wrong.. i dunno why.. anyway.. there is more to it... now when i come to the final step where shippingcosts are shown in the dropdown list (i'm using By_Weight) i get shippingcosts WITH TAX, which is right.. BUT the tax from the shippingcost SHOULD ALSO be added to the displayed tax under the subtotal... which it isn't.. .. the tax shown under the subtotal is ONLY INFO for the customer so they can see what the tax is.. NOT that this tax will be added ONTOP of the taxed products already... that's the way this whole 'tax mess' should work... now some of you might think or even say that '-why not add the products WITHOUT tax to the store'... ..well it could be done but the products are not taxfree for me either BEFORE i sell anything i mean... i guess it's like this for everybody.. nothing is taxfree... that's why the whole cost INCLUDING tax should be added to the store.. this way you have a better view or control over what you sell.... you see.. in sweden we have the next highest tax pressure in the world (except for Oslo - i heard somewhere that at the moment that's the most expensive city in the world to live in) so Ãt's best cc3 will work or we up here in scandinavia can forget to use this excellent software... that's what i think... so.. anyone got any medicin for this..?? :( Quote Link to comment Share on other sites More sharing options...
xyncro Posted July 3, 2005 Author Share Posted July 3, 2005 ... ... now.. i will even through in a tax calculation example how it's done... ..and even for those who don't know how it's done... ..this example comes from my perfectly working cc2.. which i'm very proud of.. .. ..anyway here goes.. what you see here is: 1. subtotal = 129.00 (with tax) 2. shipping = 30.00 (with tax) 3. grandtotal = 159.00 (with tax) 4. total tax 25% OUT OFF the grandtotal sum = 31.80 (only for display purpose - but must be there) 5. payment method = COD how is it calculated? 129.00 + 30.00 = 159.00 how much is the swedish tax on the 159.00 pricetag? AND.. this may seem odd but it's calculated like this... 159.00 - 20% = 31.80 (that's the tax - as calculated above) the product costs 127.20 taxfree (159.00 - 31.80) now.. how do i do if i reverse and add swedish tax back to an untaxed product? 127.20 + 25% = 159 (right..??) that's how swedish tax is calculated back and forth... again...??? well then lets go with the example below... now you see: 1. subtotal = 129.00 (with tax) 2. shipping = 115.00 (with tax) 3. grandtotal = 244.00 (with tax) 4. total tax 25% OUT OFF the grandtotal sum = 48.80 (like before - tax is only shown and is NOT added anywhere) 5. payment method = COD and the calculation goes... 129.00 + 115.00 = 244.00 and the swedish tax out of the 244.00 pricetag is..? and here again the odd calculation... 244.00 - 20% = 48.80 (that's the tax - as calculated before) so.. the product costs 195.20 untaxed (244.00 - 48.80) now.. how did i do it now to add swedish tax back again to an untaxed product..??? 195.20 + 25% = 244.00 (aaaaand voila..!!) that's the 'swedish tax calculation 4 dummies' ...back and forth... ..here's another idiotproof calculation that might look strange but is infact correct.. to achive a taxfree price (-25% the swedish tax) on a product do the following... [back] 100 (pricetag) - 20% (that's infact -25% tax) = 80 (taxfree product) [forth] 80 (taxfree product) + 25% (25% tax) = 100 (pricetag with tax) thx... now it's time for me to sleep - i mean count sheep.. nite ppl... EDIT sorry.. forgot to add... the way my cc2 works is far far away from how cc3 works... :unsure: Quote Link to comment Share on other sites More sharing options...
xyncro Posted July 5, 2005 Author Share Posted July 5, 2005 ... ..well.. i think i've made some progress with this... and plz.. if someone knows better php than me plz help or correct me... ..i want help to put the last brick in this puzzle... ..to be able to just view the tax and not being added here, there and everywhere, i've done like this... first.. set the 'Include tax in prices?' setting in admin section to 'No' then open up cart.inc.php in the includes/content folder... and on line 476-477 you see... $lineTax = ($product[0]['percent'] / 100) * $subTotal; $tax = $tax + $lineTax; replace that with this.. $tax = ($product[0]['percent'] / 125) * $subTotal; $tax = $tax + $lineTax; then further down on line 565-567 you see... $grandTotal = $subTotal + $tax + $shipCost; $view_cart->assign("LANG_CART_TOTAL",$lang['front']['cart']['cart_total']); $view_cart->assign("VAL_CART_TOTAL",priceFormat($grandTotal)); replace that with this... $grandTotal = $subTotal + $shipCost; $view_cart->assign("LANG_CART_TOTAL",$lang['front']['cart']['cart_total']); $view_cart->assign("VAL_CART_TOTAL",priceFormat($grandTotal)); after this open up your lang.inc.php file and somewhere around line 2108 you see... 'tax' => "Tax:", (in swedish - 'tax' => "moms:",) change to... 'tax' => "Tax Included:", (in swedish - 'tax' => "Varav moms:",) now.. according my tests everything should just work fine... (BUT don't take it for granted - cause i'm no php programmer)... EXCEPT for one last thing.. ..it's where i needed help with the last brick in this puzzle.. ..i asume that the shippingcost which is presented in the dropdownlist in the last step are splitted in 2 bits before it shows there.. 1 the shippingcost taxfree and the other the tax... now... what i need is the tax from that part to be added to the tax shown under the subtotal in the store... ..i hope someone better with php can help me and those others that are depended on and need this function to working properly... one other thing here... what the heck is a Linetax..?? (look up in my first change - $linetax) thx... Quote Link to comment Share on other sites More sharing options...
Guest Posted July 5, 2005 Share Posted July 5, 2005 Join me to the list! I have same problem. Has tries little various things but nothing works. Knows a pair other as wants to drive with cc3 in sweden but cannot for VAT and shipping the part Wants to buy a license but not when the does not work Hope some can fix this as soon as possible otherwise becomes the to change to something else Quote Link to comment Share on other sites More sharing options...
Guest rodders Posted July 5, 2005 Share Posted July 5, 2005 Xyncro What you're doing here doesn't just apply to Scandinavia - it's the same here in France, and I believe also in the UK. If you are TVA/VAT registered then by law you need your invoices to show the tax content of the total invoice (and also your TVA/VAT registration number - which isn't there either!). I'll follow your progress with interest. Rodders Quote Link to comment Share on other sites More sharing options...
xyncro Posted July 6, 2005 Author Share Posted July 6, 2005 ... ..thx rodders.. and pardon me.. i didn't know the french laws concerning this matter... anyhow.. then i hope anyone of the coders will take a look into this and help with the changes.. because there's no way this can be changed through the settnings in admin... btw.. did you try the replaced code i posted here..?? is that the same thing you're after..?? thx Quote Link to comment Share on other sites More sharing options...
Guest Posted July 7, 2005 Share Posted July 7, 2005 Can u break down and tell me exactly wot u want and where u want it to appear pls Quote Link to comment Share on other sites More sharing options...
xyncro Posted July 7, 2005 Author Share Posted July 7, 2005 .... hi evilhomer and thx for making an effort with this... ..ok let's see if we can get this right then... the first part of this... 'mod' is already made in a previous post up there... let's start with another smaller problem first i just notice while preparing the actual one... when i'm not logged in there is no tax displayed...!!! the tax must be displayed... plz compare the two pictures below... and you'll see it would be nice if this could be corrected... thx..!! =================== now.. to the actual problem... when one of the shipping modules is added, there is a tax setting at the bottom that adds any tax of choise to the shippingcost.. right..?? ('Generell Moms' is swedish and = 'General Tax' in english) ..now.. i would like that tax from the shipping (this concerns all the shippings) to be added to the tax under the subtotal (look below).. the result of this will be as follows.. i want 20% (the tax) taken from the sum 44.00kr (point 1)(but remeber that it should still show 44.00 as the shippingcost) and those 20% should be added to (point 2)... it should look like this below.. (with those amounts in the picture as example) Subtotal: 15.50Kr Tax: 11.90Kr (the calculation goes 44.00 - 20% = 8.80)(those 8.80 + 20% from 15.50 is 3.10 which = 11.90 in total tax) Shipping: 44.00Kr Cart Total: 59.50Kr i hope it's clear enough... thx once again for all help here... i know it's appreciated from others aswell.. Quote Link to comment Share on other sites More sharing options...
Guest strawberryfusion Posted July 8, 2005 Share Posted July 8, 2005 Hi, I've playing around with this for a few days - found a quick and dirty fix, as I'm no PHP expert. I'm sure there is a better way of doing this. Will post the 'fix' soon. Let me make sure it's working properly first. rajiv Quote Link to comment Share on other sites More sharing options...
xyncro Posted July 8, 2005 Author Share Posted July 8, 2005 ... .. nice to hear enthusiasm strawberryfusion.. even though it ought to be a more acknowledged code i'm sure we could take a look at this.. just remember how it should be calculated (look at the examples above).. thx for checking it out.. :P Quote Link to comment Share on other sites More sharing options...
Guest Immortalis Posted July 9, 2005 Share Posted July 9, 2005 xyncro Witch file is this language file? Can't find it.... after this open up your language file and somewhere around line 2108 you see... QUOTE 'tax' => "Tax:", (in swedish - 'tax' => "moms:",) change to... QUOTE 'tax' => "Tax Included:", (in swedish - 'tax' => "Varav moms:",) Quote Link to comment Share on other sites More sharing options...
xyncro Posted July 10, 2005 Author Share Posted July 10, 2005 .... ..immortalis.. sorry if i wasn't clear enough... ..in the language folder you see other folders representing other countries... you choose any country folder of your choise and then inside that you see lang.inc.php... that's the file you edit when you make changes to the displayed language that i meantioned above... i hope that helped... B) Quote Link to comment Share on other sites More sharing options...
Guest strawberryfusion Posted July 11, 2005 Share Posted July 11, 2005 Hi, I've checked it across my CubeCart and it seems to be working fine. So here is what I did: On line 545 in the cart.inc.php in the includes/content folder, add the following code: // work out tax  if($config['priceIncTax']==0 && $taxCustomer==1){  $lineTax = $subTotal - ($subTotal /(1+($product[0]['percent'] / 100)));  $shipTax = $shipCost - ($shipCost /(1+($product[0]['percent'] / 100)));  $tax = $lineTax + $shipTax;  } I have no idea of how to get the shipping tax rate so I've just used the product tax rate. It's the same in the UK. I've changed your original code slightly so you do not have hard code the tax rate into the code. For which ever Shipping Module you use, you need to make sure that the Tax class is set to Exempt for this to work. Do not forget to change your template so the the shipping cost is shown before the tax included. And finally on line 473 remove the following code: // work out tax  if($config['priceIncTax']==0 && $taxCustomer==1){   $lineTax = ($product[0]['percent'] / 100) * $subTotal;  $tax = $tax + $lineTax;   } The rest of the modifications are as per your post xyncro There are issues with how the shipping cost's are not calculated straightaway in the cart, there are some work arounds in other posts, look here to begin with. I'm not PHP expert and the code I have changed above is probably not the way to do it but for now it provides a 'quick fix', until someone comes up with a better way of doing it. It works for me and I've played around with it quite a bit and it seems to working fine. Thanks rajiv Quote Link to comment Share on other sites More sharing options...
Guest vrakas Posted July 11, 2005 Share Posted July 11, 2005 Ok guys lets hear if strawberryfusion solution has worked <_< Quote Link to comment Share on other sites More sharing options...
xyncro Posted July 12, 2005 Author Share Posted July 12, 2005 ... thx strawberryfusion.. you're a god.. this is the way tax should be calculated... you understood the whole thing up there.. ..and i think others with me and with the same problem will agree that this tax problem is now officially solved.. ..however there is still this problem that the tax is not shown if you're not looged in.. ;) Quote Link to comment Share on other sites More sharing options...
xyncro Posted July 16, 2005 Author Share Posted July 16, 2005 ... oppss... this happiness was short lived... after updating to 3.0.1 and applying these changes i get.. Parse error: parse error, unexpected T_VARIABLE in /home/xxxxx/public_html/xxxxx/includes/content/cart.inc.php on line 547 below you see the changed parts are marked red, the blue is where the fault is and the green is not there anymore.. it's deleted according strawberryfusion.. .. help appreciated...!! <?php /* +-------------------------------------------------------------------------- | CubeCart v3.0.1 | ======================================== | 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 July 2005 | Email: info (at) cubecart (dot) com | License Type: CubeCart is NOT Open Source Software and Limitations Apply | Licence Info: http://www.cubecart.com/site/faq/license.php +-------------------------------------------------------------------------- | cart.inc.php | ======================================== | Core Checkout & Cart Pages +-------------------------------------------------------------------------- */ if(!isset($config)){ echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>"; exit; } require_once("classes/cart.php"); $cart = new cart(); $basket = $cart->cartContents($ccUserData[0]['basket']); if(isset($_POST['shipping'])){ $basket = $cart->setVar($_POST['shipping'],"shipCost"); $headerLoc = "step4"; } elseif(isset($_POST['delInf'])){ $basket = $cart->setVar($_POST['delInf'],"delInf"); $headerLoc = "step4"; } function headerRedir() { global $headerLoc; if(isset($headerLoc) && !empty($headerLoc)) { header("Location: cart.php?act=".$headerLoc); } elseif(isset($_GET['act']) && !empty($_GET['act'])){ header("Location: cart.php?act=".$_GET['act']); } else { header("Location: cart.php?act=step2"); } exit; } if(isset($_GET['remove'])){ $basket = $cart->remove($_GET['remove']); headerRedir(); } elseif(isset($_POST['quan'])){ foreach($_POST['quan'] as $key => $value){ $basket = $cart->update($key,$value); } headerRedir(); } elseif(isset($_GET['mode']) && $_GET['mode']=="emptyCart"){ $basket = $cart->emptyCart(); headerRedir(); } elseif(isset($_POST['productCode']) && !empty($_POST['productCode'])) { $result = $db->select("SELECT productId FROM ".$glob['dbprefix']."CubeCart_inventory WHERE productCode = ".$db->mySQLSafe($_POST['productCode'])); if($result == TRUE) { // check for product options (if so go to view product page) $noOpts = $db->numrows("SELECT product FROM ".$glob['dbprefix']."CubeCart_options_bot WHERE product = ".$db->mySQLSafe($result[0]['productId'])); if($noOpts>0){ header("Location: index.php?act=viewProd&productId=".$result[0]['productId']); exit; } else { $basket = $cart->add($result[0]['productId'],1,""); headerRedir(); } } } $view_cart = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/cart.tpl"); $view_cart->assign("VAL_SKIN",$config['skinDir']); $view_cart->assign("LANG_VIEW_CART",$lang['front']['cart']['view_cart']); $view_cart->assign("LANG_CART",$lang['front']['cart']['cart']); $view_cart->assign("LANG_ADDRESS",$lang['front']['cart']['address']); $view_cart->assign("LANG_PAYMENT",$lang['front']['cart']['payment']); $view_cart->assign("LANG_COMPLETE",$lang['front']['cart']['complete']); $view_cart->assign("LANG_ADD_PRODCODE",$lang['front']['cart']['add_more']); $view_cart->assign("LANG_ADD",$lang['front']['cart']['add']); $view_cart->assign("LANG_QTY",$lang['front']['cart']['qty']); $view_cart->assign("LANG_PRODUCT",$lang['front']['cart']['product']); $view_cart->assign("LANG_CODE",$lang['front']['cart']['code']); $view_cart->assign("LANG_STOCK",$lang['front']['cart']['stock']); $view_cart->assign("LANG_PRICE",$lang['front']['cart']['price']); $view_cart->assign("LANG_LINE_PRICE",$lang['front']['cart']['line_price']); $view_cart->assign("LANG_DELETE",$lang['front']['cart']['delete']); $view_cart->assign("LANG_REMOVE_ITEM",$lang['front']['cart']['remove']); if($_GET['act']=="cart"){ $view_cart->assign("CLASS_STEP2","class='txtcartProgressCurrent'"); $view_cart->assign("CONT_VAL","cart.php?act=step1"); } elseif($_GET['act']=="step2"){ $view_cart->assign("CLASS_STEP2","class='txtcartProgressCurrent'"); $view_cart->assign("CONT_VAL","cart.php?act=step3"); } elseif($_GET['act']=="step3" OR $_GET['act']=="step4"){ $view_cart->assign("CLASS_STEP3","class='txtcartProgressCurrent'"); $view_cart->assign("LANG_INVOICE_ADDRESS",$lang['front']['cart']['invoice_address']); $view_cart->assign("LANG_DELIVERY_ADDRESS",$lang['front']['cart']['delivery_address']); $view_cart->assign("TXT_TITLE",$lang['front']['cart']['title']); $view_cart->assign("TXT_FIRST_NAME",$lang['front']['cart']['first_name']); $view_cart->assign("TXT_LAST_NAME",$lang['front']['cart']['last_name']); $view_cart->assign("TXT_ADD_1",$lang['front']['cart']['address2']); $view_cart->assign("TXT_ADD_2",""); $view_cart->assign("TXT_TOWN",$lang['front']['cart']['town']); $view_cart->assign("TXT_COUNTY",$lang['front']['cart']['county']); $view_cart->assign("TXT_POSTCODE",$lang['front']['cart']['postcode']); $view_cart->assign("TXT_COUNTRY",$lang['front']['cart']['country']); // stick in delivery details if(isset($basket['delInf'])){ $view_cart->assign("VAL_DEL_TITLE",$basket['delInf']['title']); $view_cart->assign("VAL_DEL_FIRST_NAME",$basket['delInf']['firstName']); $view_cart->assign("VAL_DEL_LAST_NAME",$basket['delInf']['lastName']); $view_cart->assign("VAL_DEL_ADD_1",$basket['delInf']['add_1']); $view_cart->assign("VAL_DEL_ADD_2",$basket['delInf']['add_2']); $view_cart->assign("VAL_DEL_TOWN",$basket['delInf']['town']); $view_cart->assign("VAL_DEL_COUNTY",$basket['delInf']['county']); $view_cart->assign("VAL_DEL_POSTCODE",$basket['delInf']['postcode']); $view_cart->assign("VAL_DEL_COUNTRY",countryName($basket['delInf']['country'])); } else { $view_cart->assign("VAL_DEL_TITLE",$ccUserData[0]['title']); $view_cart->assign("VAL_DEL_FIRST_NAME",$ccUserData[0]['firstName']); $view_cart->assign("VAL_DEL_LAST_NAME",$ccUserData[0]['lastName']); $view_cart->assign("VAL_DEL_ADD_1",$ccUserData[0]['add_1']); $view_cart->assign("VAL_DEL_ADD_2",$ccUserData[0]['add_2']); $view_cart->assign("VAL_DEL_TOWN",$ccUserData[0]['town']); $view_cart->assign("VAL_DEL_COUNTY",$ccUserData[0]['county']); $view_cart->assign("VAL_DEL_POSTCODE",$ccUserData[0]['postcode']); $view_cart->assign("VAL_DEL_COUNTRY",countryName($ccUserData[0]['country'])); } // stick in invoice details $view_cart->assign("VAL_TITLE",$ccUserData[0]['title']); $view_cart->assign("VAL_FIRST_NAME",$ccUserData[0]['firstName']); $view_cart->assign("VAL_LAST_NAME",$ccUserData[0]['lastName']); $view_cart->assign("VAL_ADD_1",$ccUserData[0]['add_1']); $view_cart->assign("VAL_ADD_2",$ccUserData[0]['add_2']); $view_cart->assign("VAL_TOWN",$ccUserData[0]['town']); $view_cart->assign("VAL_COUNTY",$ccUserData[0]['county']); $view_cart->assign("VAL_POSTCODE",$ccUserData[0]['postcode']); $view_cart->assign("VAL_COUNTRY",countryName($ccUserData[0]['country'])); $view_cart->assign("LANG_CHANGE_INV_ADD",$lang['front']['cart']['edit_invoice_address']); $view_cart->assign("VAL_BACK_TO",$_GET['act']); } if($_GET['act']=="step3") { if($config['shipAddressLock'] == 1){ $delInf['title'] = $ccUserData[0]['title']; $delInf['firstName'] = $ccUserData[0]['firstName']; $delInf['lastName'] = $ccUserData[0]['lastName']; $delInf['add_1'] = $ccUserData[0]['add_1']; $delInf['add_2'] = $ccUserData[0]['add_2']; $delInf['town'] = $ccUserData[0]['town']; $delInf['county'] = $ccUserData[0]['county']; $delInf['postcode'] = $ccUserData[0]['postcode']; $delInf['country'] = $ccUserData[0]['country']; $basket = $cart->setVar($delInf,"delInf"); header("Location: cart.php?act=step4"); exit; } $view_cart->assign("CONT_VAL","java script:submitDoc('cart');"); $countries = $db->select("SELECT id, printable_name FROM ".$glob['dbprefix']."CubeCart_iso_countries ORDER BY printable_name"); for($i=0; $i<count($countries); $i++){ if($countries[$i]['id'] == $ccUserData[0]['country']){ $view_cart->assign("COUNTRY_SELECTED","selected='selected'"); } else { $view_cart->assign("COUNTRY_SELECTED",""); } $view_cart->assign("VAL_DEL_COUNTRY_ID",$countries[$i]['id']); $countryName = ""; $countryName = $countries[$i]['printable_name']; if(strlen($countryName)>20){ $countryName = substr($countryName,0,20)."…"; } $view_cart->assign("VAL_DEL_COUNTRY_NAME",$countryName); $view_cart->parse("view_cart.cart_true.step_3.country_opts"); } $view_cart->parse("view_cart.cart_true.step_3"); } elseif($_GET['act']=="step4") { if($config['shipAddressLock'] == 0){ $view_cart->assign("LANG_CHANGE_DEL_ADD",$lang['front']['cart']['edit_delivery_address']); $view_cart->parse("view_cart.cart_true.step_4.edit_btn"); } $view_cart->assign("CONT_VAL","cart.php?act=step5"); $view_cart->parse("view_cart.cart_true.step_4"); } if($basket['conts'] == TRUE) { $tax = 0; $taxCustomer = 0; // work out if customer is obliged to pay tax or not if($ccUserData[0]['country']==$config['taxCountry']){ if($config['taxCounty']==0){ // tax customer $taxCustomer = 1; } elseif($config['taxCounty']==$ccUserData[0]['zoneId']){ // tax customer $taxCustomer = 1; } } $totalWeight = ""; $i = 0; $subTotal = 0; $shipCost = 0; $grandTotal = 0; foreach($basket['conts'] as $key => $value){ $i++; $productId = $cart->getProductId($key); // get product details // if shipping by category is enabled we need to get the values too $module = fetchDbConfig("Per_Category"); $shipByCat = $module['status']; $extraJoin = ""; if($shipByCat==1 && $_GET['act']=="step4"){ $extraJoin = "INNER JOIN ".$glob['dbprefix']."CubeCart_category ON ".$glob['dbprefix']."CubeCart_inventory.cat_id = ".$glob['dbprefix']."CubeCart_category.cat_id"; } $product = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory INNER JOIN ".$glob['dbprefix']."CubeCart_taxes ON ".$glob['dbprefix']."CubeCart_taxes.id = taxType ".$extraJoin." WHERE productId=".$db->mySQLSafe($productId)); if(($val = prodAltLang($product[0]['productId'])) == TRUE){ $product[0]['name'] = $val['name']; } $view_cart->assign("TD_CART_CLASS",cellColor($i, $tdEven="tdcartEven", $tdOdd="tdcartOdd")); $view_cart->assign("VAL_PRODUCT_ID",$productId); $view_cart->assign("VAL_CURRENT_STEP",$_GET['act']); $view_cart->assign("VAL_PRODUCT_KEY",$key); if(empty($product[0]["image"])){ $view_cart->assign("VAL_IMG_SRC","skins/".$config['skinDir']."/styleImages/thumb_nophoto.gif"); } else { $view_cart->assign("VAL_IMG_SRC","images/uploads/thumbs/thumb_".$product[0]["image"]); } // only calculate shipping IF the product is tangible if($product[0]["digital"]==0){ $orderTangible = TRUE; } $view_cart->assign("VAL_PRODUCT_NAME",$product[0]["name"]); $view_cart->assign("VAL_PRODUCT_CODE",$product[0]["productCode"]); // build the product options $optionKeys = $cart->getOptions($key); $optionsCost = 0; $plainOpts = ""; if(!empty($optionKeys)){ $options = explode(".",$optionKeys); foreach($options as $value) { // look up options in database $option = $db->select("SELECT ".$glob['dbprefix']."CubeCart_options_bot.option_id, ".$glob['dbprefix']."CubeCart_options_bot.value_id, option_price, option_symbol, value_name, option_name, assign_id FROM `".$glob['dbprefix']."CubeCart_options_bot` INNER JOIN `".$glob['dbprefix']."CubeCart_options_mid` ON ".$glob['dbprefix']."CubeCart_options_mid.value_id = ".$glob['dbprefix']."CubeCart_options_bot.value_id INNER JOIN `".$glob['dbprefix']."CubeCart_options_top` ON ".$glob['dbprefix']."CubeCart_options_bot.option_id = ".$glob['dbprefix']."CubeCart_options_top.option_id WHERE assign_id = ".$value); $view_cart->assign("VAL_OPT_NAME",$option[0]['option_name']); $view_cart->assign("VAL_OPT_VALUE",$option[0]['value_name']); $plainOpts .= $option[0]['option_name']." - ".$option[0]['value_name']."\r\n"; if($option[0]['option_price']>0){ if($option[0]['option_symbol']=="+"){ $optionsCost = $optionsCost + $option[0]['option_price']; } elseif($option[0]['option_symbol']=="-"){ $optionsCost = $optionsCost - $option[0]['option_price']; } elseif($option[0]['option_symbol']=="~"){ $optionsCost = 0; } } $view_cart->parse("view_cart.cart_true.repeat_cart_contents.options"); } } if($product[0]["useStockLevel"]==1){ $view_cart->assign("VAL_INSTOCK",$product[0]["stock_level"]); } else { $view_cart->assign("VAL_INSTOCK","∞"); } if(($config['outofstockPurchase']==1) && ($product[0]["stock_level"]<$cart->cartArray['conts'][$key]["quantity"]) && ($product[0]["useStockLevel"]==1)) { $view_cart->assign("VAL_STOCK_WARN",$lang['front']['cart']['stock_warn']); $quantity = $cart->cartArray['conts'][$key]["quantity"]; $view_cart->parse("view_cart.repeat_cart_contents.stock_warn"); } elseif(($config['outofstockPurchase']==0) && ($product[0]["stock_level"]<$cart->cartArray['conts'][$key]["quantity"]) && ($product[0]["useStockLevel"]==1)) { $view_cart->assign("VAL_STOCK_WARN",$lang['front']['cart']['amount_capped']." ".$product[0]["stock_level"]."."); $quantity = $product[0]["stock_level"]; $basket = $cart->update($key,$quantity); $view_cart->parse("view_cart.cart_true.repeat_cart_contents.stock_warn"); } else { $quantity = $cart->cartArray['conts'][$key]["quantity"]; } $view_cart->assign("VAL_QUANTITY",$quantity); if(salePrice($product[0]['price'], $product[0]['sale_price'])==FALSE){ $price = $product[0]['price']; } else { $price = salePrice($product[0]['price'], $product[0]['sale_price']); } $price = $price + ($optionsCost); if(isset($_GET['act']) && $_GET['act']=="step4"){ // set live vars for order inv and its the last step $basket = $cart->setVar($productId,"productId","invArray",$i); $basket = $cart->setVar($product[0]['name'],"name","invArray",$i); $basket = $cart->setVar($product[0]['productCode'],"productCode","invArray",$i); $basket = $cart->setVar($plainOpts,"prodOptions","invArray",$i); $basket = $cart->setVar(sprintf("%.2f",$price*$quantity),"price","invArray",$i); $basket = $cart->setVar($quantity,"quantity","invArray",$i); $basket = $cart->setVar($product[0]['digital'],"digital","invArray",$i); } $view_cart->assign("VAL_IND_PRICE",priceFormat($price)); $view_cart->assign("VAL_LINE_PRICE",priceFormat($price*$quantity)); if($shipByCat==1 && $_GET['act']=="step4"){ // calculate the line category shipping price include("modules/shipping/Per_Category/line.inc.php"); } $subTotal = $subTotal + ($price * $quantity); $view_cart->parse("view_cart.cart_true.repeat_cart_contents"); // work out weight if($product[0]['prodWeight']>0 && $product[0]['digital']==0){ $totalWeight = ($product[0]['prodWeight'] * $quantity) + $totalWeight; } // work out tax if($config['priceIncTax']==0 && $taxCustomer==1){ $lineTax = ($product[0]['percent'] / 100) * $subTotal; $tax = $tax + $lineTax; } } // calculate shipping when we have reached step4 or over if($_GET['act']=="step4" && $orderTangible==TRUE) { $shippingModules = $db->select("SELECT folder FROM ".$glob['dbprefix']."CubeCart_Modules WHERE module='shipping' AND status = 1"); $noItems = $cart->noItems(); $optNo = ""; $sum = 0; if($shippingModules == TRUE){ $shippingPrice = "<select name='shipping' onchange=\"submitDoc('cart');\">"; // add shipping cost if it has already been made if(isset($basket['shipCost']) && !empty($basket['shipCost'])) { $shipArray = explode("|",$basket['shipCost']); $optNo = $shipArray[0]; if(isset($shipArray[1])){ $shipCost = $shipArray[1]; } } for($i=0; $i<count($shippingModules); $i++){ include("modules/shipping/".$shippingModules[$i]['folder']."/calc.php"); // add shipping cost if it has not already been made if(!isset($basket['shipCost']) && empty($basket['shipCost'])) { $shipCost = sprintf("%.2f", $sum); $basket = $cart->setVar($i."|".$shipCost,"shipCost"); } } $shippingPrice .= "</select>"; } else { $shippingPrice .= "<select name='shipping' onchange=\"submitDoc('cart');\">\r\n<option value='0.00'>".$lang['front']['cart']['free_shipping']."</option>\r\n</select>"; $basket = $cart->setVar($lang['front']['cart']['free_shipping'],"shipMethod"); } } elseif($_GET['act']=="step4"){ $shippingPrice = "<select name='shipping'><option value='0.00'>".$lang['front']['cart']['free_shipping']."</option></select>"; $basket = $cart->setVar($lang['front']['cart']['free_shipping'],"shipMethod"); } else { $shippingPrice = $lang['front']['cart']['na']; } // work out tax if($config['priceIncTax']==0 && $taxCustomer==1){ $lineTax = $subTotal - ($subTotal /(1+($product[0]['percent'] / 100))); $shipTax = $shipCost - ($shipCost /(1+($product[0]['percent'] / 100))); $tax = $lineTax + $shipTax; } $view_cart->assign("LANG_SHIPPING",$lang['front']['cart']['shipping']) $view_cart->assign("VAL_SHIPPING",$shippingPrice); $view_cart->assign("LANG_TAX",$lang['front']['cart']['tax']); if($tax>0){ $view_cart->assign("VAL_TAX",priceFormat($tax)); } else { $view_cart->assign("VAL_TAX",$lang['front']['cart']['na']); } $view_cart->assign("LANG_SUBTOTAL",$lang['front']['cart']['subtotal']); $view_cart->assign("VAL_SUBTOTAL",priceFormat($subTotal)); $grandTotal = $subTotal + $shipCost; $view_cart->assign("LANG_CART_TOTAL",$lang['front']['cart']['cart_total']); $view_cart->assign("VAL_CART_TOTAL",priceFormat($grandTotal)); if(isset($_GET['act']) && $_GET['act']=="step4"){ // build array of price vars in session data $basket = $cart->setVar(sprintf("%.2f",$subTotal),"subTotal"); $basket = $cart->setVar(sprintf("%.2f",$tax),"tax"); $basket = $cart->setVar(sprintf("%.2f",$shipCost),"shipCostAmount"); $basket = $cart->setVar(sprintf("%.2f",$grandTotal),"grandTotal"); } $view_cart->assign("LANG_UPDATE_CART_DESC",$lang['front']['cart']['if_changed_quan']); $view_cart->assign("LANG_UPDATE_CART",$lang['front']['cart']['update_cart']); $view_cart->assign("LANG_CHECKOUT",$lang['front']['cart']['continue']); $view_cart->assign("VAL_FORM_ACTION",currentPage()); $view_cart->parse("view_cart.cart_true"); } else { $view_cart->assign("LANG_CART_EMPTY",$lang['front']['cart']['cart_empty']); $view_cart->parse("view_cart.cart_false"); } $view_cart->parse("view_cart"); $page_content = $view_cart->text("view_cart"); ?> Quote Link to comment Share on other sites More sharing options...
Guest Posted July 17, 2005 Share Posted July 17, 2005 Can somebody fix this one? It´s would be nice so one can start the shop this year ;) Quote Link to comment Share on other sites More sharing options...
Guest strawberryfusion Posted July 18, 2005 Share Posted July 18, 2005 Hi, The problem is in the line above the one marked in blue, I think it's line 551: $view_cart->assign("LANG_SHIPPING",$lang['front']['cart']['shipping']) The semi-colon is missing, just add it to the end of the line: $view_cart->assign("LANG_SHIPPING",$lang['front']['cart']['shipping']); That should fix the error. Thanks rajiv Quote Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2005 Share Posted July 18, 2005 Hello all! I have tried this cod and the sees out to work good. The counts out VAT and shipping all the way. But in ends mailes "OrderForum" so stands the sum on 0. All other is okay. So the is only that the will print the just finished sum. Some as can find this error? Sorry for my bad english.. I am using Systran to translate. Some one fix this out? <?php /* +-------------------------------------------------------------------------- | CubeCart v3.0.0 | ======================================== | 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, 1 July 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 +-------------------------------------------------------------------------- | cart.inc.php | ======================================== | Core Checkout & Cart Pages +-------------------------------------------------------------------------- */ if(!isset($config)){ echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>"; exit; } require_once("classes/cart.php"); $cart = new cart(); $basket = $cart->cartContents($ccUserData[0]['basket']); if(isset($_POST['shipping'])){ $basket = $cart->setVar($_POST['shipping'],"shipCost"); $headerLoc = "step4"; } elseif(isset($_POST['delInf'])){ $basket = $cart->setVar($_POST['delInf'],"delInf"); $headerLoc = "step4"; } function headerRedir() { global $headerLoc; if(isset($headerLoc) && !empty($headerLoc)) { header("Location: cart.php?act=".$headerLoc); } elseif(isset($_GET['act']) && !empty($_GET['act'])){ header("Location: cart.php?act=".$_GET['act']); } else { header("Location: cart.php?act=step2"); } exit; } if(isset($_GET['remove'])){ $basket = $cart->remove($_GET['remove']); headerRedir(); } elseif(isset($_POST['quan'])){ foreach($_POST['quan'] as $key => $value){ $basket = $cart->update($key,$value); } headerRedir(); } elseif(isset($_GET['mode']) && $_GET['mode']=="emptyCart"){ $basket = $cart->emptyCart(); headerRedir(); } elseif(isset($_POST['productCode']) && !empty($_POST['productCode'])) { $result = $db->select("SELECT productId FROM ".$glob['dbprefix']."CubeCart_inventory WHERE productCode = ".$db->mySQLSafe($_POST['productCode'])); if($result == TRUE) { // check for product options (if so go to view product page) $noOpts = $db->numrows("SELECT product FROM ".$glob['dbprefix']."CubeCart_options_bot WHERE product = ".$db->mySQLSafe($result[0]['productId'])); if($noOpts>0){ header("Location: index.php?act=viewProd&productId=".$result[0]['productId']); exit; } else { $basket = $cart->add($result[0]['productId'],1,""); headerRedir(); } } } $view_cart = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/cart.tpl"); //////////////////////// // BUILD SUB CATEGORIES //////// $view_cart->assign("LANG_VIEW_CART",$lang['front']['cart']['view_cart']); $view_cart->assign("LANG_CART",$lang['front']['cart']['cart']); $view_cart->assign("LANG_ADDRESS",$lang['front']['cart']['address']); $view_cart->assign("LANG_PAYMENT",$lang['front']['cart']['payment']); $view_cart->assign("LANG_COMPLETE",$lang['front']['cart']['complete']); $view_cart->assign("LANG_ADD_PRODCODE",$lang['front']['cart']['add_more']); $view_cart->assign("LANG_ADD",$lang['front']['cart']['add']); $view_cart->assign("LANG_QTY",$lang['front']['cart']['qty']); $view_cart->assign("LANG_PRODUCT",$lang['front']['cart']['product']); $view_cart->assign("LANG_CODE",$lang['front']['cart']['code']); $view_cart->assign("LANG_STOCK",$lang['front']['cart']['stock']); $view_cart->assign("LANG_PRICE",$lang['front']['cart']['price']); $view_cart->assign("LANG_LINE_PRICE",$lang['front']['cart']['line_price']); $view_cart->assign("LANG_DELETE",$lang['front']['cart']['delete']); $view_cart->assign("LANG_REMOVE_ITEM",$lang['front']['cart']['remove']); if($_GET['act']=="cart"){ $view_cart->assign("CLASS_STEP2","class='txtcartProgressCurrent'"); $view_cart->assign("CONT_VAL","cart.php?act=step1"); } elseif($_GET['act']=="step2"){ $view_cart->assign("CLASS_STEP2","class='txtcartProgressCurrent'"); $view_cart->assign("CONT_VAL","cart.php?act=step3"); } elseif($_GET['act']=="step3" OR $_GET['act']=="step4"){ $view_cart->assign("CLASS_STEP3","class='txtcartProgressCurrent'"); $view_cart->assign("LANG_INVOICE_ADDRESS",$lang['front']['cart']['invoice_address']); $view_cart->assign("LANG_DELIVERY_ADDRESS",$lang['front']['cart']['delivery_address']); $view_cart->assign("TXT_TITLE",$lang['front']['cart']['title']); $view_cart->assign("TXT_FIRST_NAME",$lang['front']['cart']['first_name']); $view_cart->assign("TXT_LAST_NAME",$lang['front']['cart']['last_name']); $view_cart->assign("TXT_ADD_1",$lang['front']['cart']['address2']); $view_cart->assign("TXT_ADD_2",""); $view_cart->assign("TXT_TOWN",$lang['front']['cart']['town']); $view_cart->assign("TXT_COUNTY",$lang['front']['cart']['county']); $view_cart->assign("TXT_POSTCODE",$lang['front']['cart']['postcode']); $view_cart->assign("TXT_COUNTRY",$lang['front']['cart']['country']); // stick in delivery details if(isset($basket['delInf'])){ $view_cart->assign("VAL_DEL_TITLE",$basket['delInf']['title']); $view_cart->assign("VAL_DEL_FIRST_NAME",$basket['delInf']['firstName']); $view_cart->assign("VAL_DEL_LAST_NAME",$basket['delInf']['lastName']); $view_cart->assign("VAL_DEL_ADD_1",$basket['delInf']['add_1']); $view_cart->assign("VAL_DEL_ADD_2",$basket['delInf']['add_2']); $view_cart->assign("VAL_DEL_TOWN",$basket['delInf']['town']); $view_cart->assign("VAL_DEL_COUNTY",$basket['delInf']['county']); $view_cart->assign("VAL_DEL_POSTCODE",$basket['delInf']['postcode']); $view_cart->assign("VAL_DEL_COUNTRY",countryName($basket['delInf']['country'])); } else { $view_cart->assign("VAL_DEL_TITLE",$ccUserData[0]['title']); $view_cart->assign("VAL_DEL_FIRST_NAME",$ccUserData[0]['firstName']); $view_cart->assign("VAL_DEL_LAST_NAME",$ccUserData[0]['lastName']); $view_cart->assign("VAL_DEL_ADD_1",$ccUserData[0]['add_1']); $view_cart->assign("VAL_DEL_ADD_2",$ccUserData[0]['add_2']); $view_cart->assign("VAL_DEL_TOWN",$ccUserData[0]['town']); $view_cart->assign("VAL_DEL_COUNTY",$ccUserData[0]['county']); $view_cart->assign("VAL_DEL_POSTCODE",$ccUserData[0]['postcode']); $view_cart->assign("VAL_DEL_COUNTRY",countryName($ccUserData[0]['country'])); } // stick in invoice details $view_cart->assign("VAL_TITLE",$ccUserData[0]['title']); $view_cart->assign("VAL_FIRST_NAME",$ccUserData[0]['firstName']); $view_cart->assign("VAL_LAST_NAME",$ccUserData[0]['lastName']); $view_cart->assign("VAL_ADD_1",$ccUserData[0]['add_1']); $view_cart->assign("VAL_ADD_2",$ccUserData[0]['add_2']); $view_cart->assign("VAL_TOWN",$ccUserData[0]['town']); $view_cart->assign("VAL_COUNTY",$ccUserData[0]['county']); $view_cart->assign("VAL_POSTCODE",$ccUserData[0]['postcode']); $view_cart->assign("VAL_COUNTRY",countryName($ccUserData[0]['country'])); $view_cart->assign("LANG_CHANGE_INV_ADD",$lang['front']['cart']['edit_invoice_address']); $view_cart->assign("VAL_BACK_TO",$_GET['act']); } if($_GET['act']=="step3") { if($config['shipAddressLock'] == 1){ $delInf['title'] = $ccUserData[0]['title']; $delInf['firstName'] = $ccUserData[0]['firstName']; $delInf['lastName'] = $ccUserData[0]['lastName']; $delInf['add_1'] = $ccUserData[0]['add_1']; $delInf['add_2'] = $ccUserData[0]['add_2']; $delInf['town'] = $ccUserData[0]['town']; $delInf['county'] = $ccUserData[0]['county']; $delInf['postcode'] = $ccUserData[0]['postcode']; $delInf['country'] = $ccUserData[0]['country']; $basket = $cart->setVar($delInf,"delInf"); header("Location: cart.php?act=step4"); exit; } $view_cart->assign("CONT_VAL","java script:submitDoc('cart');"); $countries = $db->select("SELECT id, printable_name FROM ".$glob['dbprefix']."CubeCart_iso_countries ORDER BY printable_name"); for($i=0; $i<count($countries); $i++){ if($countries[$i]['id'] == $ccUserData[0]['country']){ $view_cart->assign("COUNTRY_SELECTED","selected='selected'"); } else { $view_cart->assign("COUNTRY_SELECTED",""); } $view_cart->assign("VAL_DEL_COUNTRY_ID",$countries[$i]['id']); $countryName = ""; $countryName = $countries[$i]['printable_name']; if(strlen($countryName)>20){ $countryName = substr($countryName,0,20)."…"; } $view_cart->assign("VAL_DEL_COUNTRY_NAME",$countryName); $view_cart->parse("view_cart.cart_true.step_3.country_opts"); } $view_cart->parse("view_cart.cart_true.step_3"); } elseif($_GET['act']=="step4") { if($config['shipAddressLock'] == 0){ $view_cart->assign("LANG_CHANGE_DEL_ADD",$lang['front']['cart']['edit_delivery_address']); $view_cart->parse("view_cart.cart_true.step_4.edit_btn"); } $view_cart->assign("CONT_VAL","cart.php?act=step5"); $view_cart->parse("view_cart.cart_true.step_4"); } if($basket['conts'] == TRUE) { $tax = 0; $taxCustomer = 0; // work out if customer is obliged to pay tax or not if($ccUserData[0]['country']==$config['taxCountry']){ if($config['taxCounty']==0){ // tax customer $taxCustomer = 1; } elseif($config['taxCounty']==$ccUserData[0]['zoneId']){ // tax customer $taxCustomer = 1; } } $totalWeight = ""; $i = 0; $subTotal = 0; $shipCost = 0; $grandTotal = 0; foreach($basket['conts'] as $key => $value){ $i++; $productId = $cart->getProductId($key); // get product details // if shipping by category is enabled we need to get the values too $module = fetchDbConfig("Per_Category"); $shipByCat = $module['status']; $extraJoin = ""; if($shipByCat==1 && $_GET['act']=="step4"){ $extraJoin = "INNER JOIN ".$glob['dbprefix']."CubeCart_category ON ".$glob['dbprefix']."CubeCart_inventory.cat_id = ".$glob['dbprefix']."CubeCart_category.cat_id"; } $product = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory INNER JOIN ".$glob['dbprefix']."CubeCart_taxes ON ".$glob['dbprefix']."CubeCart_taxes.id = taxType ".$extraJoin." WHERE productId=".$db->mySQLSafe($productId)); if(($val = prodAltLang($product[0]['productId'])) == TRUE){ $product[0]['name'] = $val['name']; } $view_cart->assign("TD_CART_CLASS",cellColor($i, $tdEven="tdcartEven", $tdOdd="tdcartOdd")); $view_cart->assign("VAL_PRODUCT_ID",$productId); $view_cart->assign("VAL_CURRENT_STEP",$_GET['act']); $view_cart->assign("VAL_PRODUCT_KEY",$key); if(empty($product[0]["image"])){ $view_cart->assign("VAL_IMG_SRC","skins/".$config['skinDir']."/styleImages/thumb_nophoto.gif"); } else { $view_cart->assign("VAL_IMG_SRC","images/uploads/thumbs/thumb_".$product[0]["image"]); } // only calculate shipping IF the product is tangible if($product[0]["digital"]==0){ $orderTangible = TRUE; } $view_cart->assign("VAL_PRODUCT_NAME",$product[0]["name"]); $view_cart->assign("VAL_PRODUCT_CODE",$product[0]["productCode"]); // build the product options $optionKeys = $cart->getOptions($key); $optionsCost = 0; $plainOpts = ""; if(!empty($optionKeys)){ $options = explode(".",$optionKeys); foreach($options as $value) { // look up options in database $option = $db->select("SELECT ".$glob['dbprefix']."CubeCart_options_bot.option_id, ".$glob['dbprefix']."CubeCart_options_bot.value_id, option_price, option_symbol, value_name, option_name, assign_id FROM `".$glob['dbprefix']."CubeCart_options_bot` INNER JOIN `".$glob['dbprefix']."CubeCart_options_mid` ON ".$glob['dbprefix']."CubeCart_options_mid.value_id = ".$glob['dbprefix']."CubeCart_options_bot.value_id INNER JOIN `".$glob['dbprefix']."CubeCart_options_top` ON ".$glob['dbprefix']."CubeCart_options_bot.option_id = ".$glob['dbprefix']."CubeCart_options_top.option_id WHERE assign_id = ".$value); $view_cart->assign("VAL_OPT_NAME",$option[0]['option_name']); $view_cart->assign("VAL_OPT_VALUE",$option[0]['value_name']); $plainOpts .= $option[0]['option_name']." - ".$option[0]['value_name']."\r\n"; if($option[0]['option_price']>0){ if($option[0]['option_symbol']=="+"){ $optionsCost = $optionsCost + $option[0]['option_price']; } elseif($option[0]['option_symbol']=="-"){ $optionsCost = $optionsCost - $option[0]['option_price']; } elseif($option[0]['option_symbol']=="~"){ $optionsCost = 0; } } $view_cart->parse("view_cart.cart_true.repeat_cart_contents.options"); } } if($product[0]["useStockLevel"]==1){ $view_cart->assign("VAL_INSTOCK",$product[0]["stock_level"]); } else { $view_cart->assign("VAL_INSTOCK","∞"); } if(($config['outofstockPurchase']==1) && ($product[0]["stock_level"]<$cart->cartArray['conts'][$key]["quantity"]) && ($product[0]["useStockLevel"]==1)) { $view_cart->assign("VAL_STOCK_WARN",$lang['front']['cart']['stock_warn']); $quantity = $cart->cartArray['conts'][$key]["quantity"]; $view_cart->parse("view_cart.repeat_cart_contents.stock_warn"); } elseif(($config['outofstockPurchase']==0) && ($product[0]["stock_level"]<$cart->cartArray['conts'][$key]["quantity"]) && ($product[0]["useStockLevel"]==1)) { $view_cart->assign("VAL_STOCK_WARN",$lang['front']['cart']['amount_capped']." ".$product[0]["stock_level"]."."); $quantity = $product[0]["stock_level"]; $basket = $cart->update($key,$quantity); $view_cart->parse("view_cart.cart_true.repeat_cart_contents.stock_warn"); } else { $quantity = $cart->cartArray['conts'][$key]["quantity"]; } $view_cart->assign("VAL_QUANTITY",$quantity); if(salePrice($product[0]['price'], $product[0]['sale_price'])==FALSE){ $price = $product[0]['price']; } else { $price = salePrice($product[0]['price'], $product[0]['sale_price']); } $price = $price + ($optionsCost); if(isset($_GET['act']) && $_GET['act']=="step4"){ // set live vars for order inv and its the last step $basket = $cart->setVar($productId,"productId","invArray",$i); $basket = $cart->setVar($product[0]['name'],"name","invArray",$i); $basket = $cart->setVar($product[0]['productCode'],"productCode","invArray",$i); $basket = $cart->setVar($plainOpts,"prodOptions","invArray",$i); $basket = $cart->setVar(sprintf("%.2f",$price*$quantity),"price","invArray",$i); $basket = $cart->setVar($quantity,"quantity","invArray",$i); $basket = $cart->setVar($product[0]['digital'],"digital","invArray",$i); } $view_cart->assign("VAL_IND_PRICE",priceFormat($price)); $view_cart->assign("VAL_LINE_PRICE",priceFormat($price*$quantity)); if($shipByCat==1 && $_GET['act']=="step4"){ // calculate the line category shipping price include("modules/shipping/Per_Category/line.inc.php"); } $subTotal = $subTotal + ($price * $quantity); $view_cart->parse("view_cart.cart_true.repeat_cart_contents"); // work out weight if($product[0]['prodWeight']>0 && $product[0]['digital']==0){ $totalWeight = ($product[0]['prodWeight'] * $quantity) + $totalWeight; } } // calculate shipping when we have reached step4 or over if($_GET['act']=="step4" && $orderTangible==TRUE) { $shippingModules = $db->select("SELECT folder FROM ".$glob['dbprefix']."CubeCart_Modules WHERE module='shipping' AND status = 1"); $noItems = $cart->noItems(); $optNo = ""; $sum = 0; if($shippingModules == TRUE){ $shippingPrice = "<select name='shipping' onchange=\"submitDoc('cart');\">"; // add shipping cost if it has already been made if(isset($basket['shipCost']) && !empty($basket['shipCost'])) { $shipArray = explode("|",$basket['shipCost']); $optNo = $shipArray[0]; if(isset($shipArray[1])){ $shipCost = $shipArray[1]; } } for($i=0; $i<count($shippingModules); $i++){ include("modules/shipping/".$shippingModules[$i]['folder']."/calc.php"); // add shipping cost if it has not already been made if(!isset($basket['shipCost']) && empty($basket['shipCost'])) { $shipCost = sprintf("%.2f", $sum); $basket = $cart->setVar($i."|".$shipCost,"shipCost"); } } $shippingPrice .= "</select>"; } else { $shippingPrice .= "<option value='0.00'>".$lang['front']['cart']['free_shipping']."</option>"; $basket = $cart->setVar($lang['front']['cart']['free_shipping'],"shipMethod"); } } elseif($_GET['act']=="step4"){ $shippingPrice = "<select name='shipping'><option value='0.00'>".$lang['front']['cart']['free_shipping']."</option></select>"; $basket = $cart->setVar($lang['front']['cart']['free_shipping'],"shipMethod"); } else { $shippingPrice = $lang['front']['cart']['na']; } // work out tax if($config['priceIncTax']==0 && $taxCustomer==1){ $lineTax = $subTotal - ($subTotal /(1+($product[0]['percent'] / 100))); $shipTax = $shipCost - ($shipCost /(1+($product[0]['percent'] / 100))); $tax = $lineTax + $shipTax; } $view_cart->assign("LANG_SHIPPING",$lang['front']['cart']['shipping']); $view_cart->assign("VAL_SHIPPING",$shippingPrice); $view_cart->assign("LANG_TAX",$lang['front']['cart']['tax']); if($tax>0){ $view_cart->assign("VAL_TAX",priceFormat($tax)); } else { $view_cart->assign("VAL_TAX",$lang['front']['cart']['na']); } $view_cart->assign("LANG_SUBTOTAL",$lang['front']['cart']['subtotal']); $view_cart->assign("VAL_SUBTOTAL",priceFormat($subTotal)); $grandTotal = $subTotal + $shipCost; $view_cart->assign("LANG_CART_TOTAL",$lang['front']['cart']['cart_total']); $view_cart->assign("VAL_CART_TOTAL",priceFormat($grandTotal)); if(isset($_GET['act']) && $_GET['act']=="step4"){ // build array of price vars in session data $basket = $cart->setVar(sprintf("%.2f",$subTotal),"subTotal"); $basket = $cart->setVar(sprintf("%.2f",$tax),"tax"); $basket = $cart->setVar(sprintf("%.2f",$shipCost),"shipCost"); $basket = $cart->setVar(sprintf("%.2f",$grandTotal),"grandTotal"); } $view_cart->assign("LANG_UPDATE_CART_DESC",$lang['front']['cart']['if_changed_quan']); $view_cart->assign("LANG_UPDATE_CART",$lang['front']['cart']['update_cart']); $view_cart->assign("LANG_CHECKOUT",$lang['front']['cart']['continue']); $view_cart->assign("VAL_FORM_ACTION",currentPage()); $view_cart->parse("view_cart.cart_true"); } else { $view_cart->assign("LANG_CART_EMPTY",$lang['front']['cart']['cart_empty']); $view_cart->parse("view_cart.cart_false"); } $view_cart->parse("view_cart"); $page_content = $view_cart->text("view_cart"); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.