Author Topic: Weird lines in Cart.php should be removed VM3  (Read 520 times)

virtuemartaustralia

  • 3rd party VirtueMart Developer
  • Beginner
  • *
  • Posts: 14
  • Virtuemart Australia & New Zealand
    • Virtuemart Australia
  • VirtueMart Version: 3.2.12
Weird lines in Cart.php should be removed VM3
« on: May 06, 2015, 05:30:09 am »
Dear Dev team!
We have encountered a problem costed us 3 hours, we thought it's our post plugin's problem, then suspected cmsmart opc's problem, then finally spotted these lines.

components/com_virtuemart/controllers/cart.php

public function updatecart($html=true){

if(empty($cart->selected_shipto) or $cart->selected_shipto<1){
$cart->STsameAsBT = 1;
$cart->selected_shipto = 0;
} else {
$cart->STsameAsBT = 0;
}

These lines should be removed!!
I suppose it is detecting if any saved Shipto info is chosen, but not every opc plugin has saved shipto list for choosing, for eg: cmsmart opc.
 thus while saving the order to database, the variable STsameAsBT was changed to 1 every time, but it's the variable we use to calculate the postage!
 It should use the ST zip cuz STsameAsBT was not chosen, but instead it used BT zip cuz u changed this variable in php.
IMHO, u should not change this variable in php.
www.virtuemartoz.com
Shipping: AusPost NZPost
Payment: eWay, SecurePay, merchantwarrior, ematters, paymentexpress
Infinite Scroll,Category Discount,wholesale Discount
Westfield Integration, Make An Offer/Best Offer
We do things others can't do, call Us For A hand of help.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9838
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Weird lines in Cart.php should be removed VM3
« Reply #1 on: May 06, 2015, 15:11:23 pm »
Ehrm, read your post again. You may get the error of your proposel yourself.

and btw, your 3 hours are a joke compared to the weeks we worked on that. Go the cmsmart, explain them, that the selected_shipto is actually used since vm2, if not even vm1.1
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2896
  • VirtueMart Version: 3.4
Re: Weird lines in Cart.php should be removed VM3
« Reply #2 on: May 06, 2015, 15:47:13 pm »
Quote
These lines should be removed!!


Noooooo!

The cart is working fine

" but it's the variable we use to calculate the postage!"

Then change the way your system works!

3 hours - pah!!!

I spent more hours testing this for free!

I suggest you sort out your own OPC issues
regards
A

Joomla 3.9.1
php 7.1