Virtuemart Product Module Price and Related product problem

Started by dragonself, May 16, 2014, 08:13:42 AM

Previous topic - Next topic

dragonself

I am using version 2.6.0 virtuemart product module and 2.6.0 virtuemart
Problem appear with the following setting
I use the module to display 6 product in a category (E.g id: 74 78 77 80 75 79)
Within the 6 product, 75 contain three related product (e.g 78,80,79)
I config the module not to display price, but end up, 78,80,79 display price.

I did a bit i digging, but when productmodel call customfieldmodel, and customfieldmodel call a new productmodel, I have no idea want will happen, so need some support here. Below are my digging:

I print the different between a good product (which do not display price) and a bad product (that display price for some reason)
Good one:
    ["prices"]=>
    array(1) {
     
  • =>
          array(12) {
            ["virtuemart_product_price_id"]=>
            string(2) "49"
            ["product_price"]=>
            string(8) "68.99000"
            ["override"]=>
            string(1) "0"
            ["product_override_price"]=>
            string(7) "0.00000"
            ["product_tax_id"]=>
            string(1) "0"
            ["product_discount_id"]=>
            string(1) "0"
            ["product_currency"]=>
            string(2) "61"
    Bad one:
    ["prices"]=>
        array(18) {
          ["costPrice"]=>
          string(8) "34.99000"
          ["basePrice"]=>
          float(34.99)
          ["basePriceVariant"]=>
          float(34.99)
          ["basePriceWithTax"]=>
          float(0)
          ["discountedPriceWithoutTax"]=>
          float(34.99)
          ["priceBeforeTax"]=>
          float(34.99)
          ["salesPrice"]=>
          float(34.99)
          ["taxAmount"]=>
          float(0)
          ["salesPriceWithDiscount"]=>
          float(0)
          ["salesPriceTemp"]=>
          float(34.99)

    They are very different in structure.

    In productmodel, function getProducts :
    getProducts is doing a loop over the ids. (In my case, single = false)
    For 74 78 77 80 in products[]  price is good. But 78 and 80 get messed up after the getProduct function of 75 is called
    This is what I don't understand, how can products[] be affected after getProduct call

    I keep digging into getProduct > getProductSingle

    In productmodel, function getProductSingle:
    Around line 1179 (+/- 100 line due to my error_log =.=)
    $product->customfieldsRelatedProducts = $customfieldModel->getProductCustomsFieldRelatedProducts ($product);
    Thing work fine if I comment out this line.

    I keep digging into getProductCustomsFieldRelatedProducts > displayProductCustomfieldFE
    around line 1128
    case 'R':
       $pModel = VmModel::getModel('product');
       $related = $pModel->getProduct((int)$value,TRUE,TRUE,TRUE,1,FALSE);

    I am confused here, will this getProduct overwrite the pervious getProduct result?
    And all those "withcalc" parameter is hardcode here.

    Any recommended changes to fix it?

    Thanks in advance.
    Philip













    ;






dragonself

Anyone have tried and have the sample problem?
Basically, the problem is that the category page show price of product that have related product and didn't show price if the product don't have related product.

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/