Virtuemart Product Module Price and Related product problem

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

Previous topic - Next topic


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:
    array(1) {
  • =>
          array(12) {
            string(2) "49"
            string(8) "68.99000"
            string(1) "0"
            string(7) "0.00000"
            string(1) "0"
            string(1) "0"
            string(2) "61"
    Bad one:
        array(18) {
          string(8) "34.99000"

    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.



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.


Should I fix your bug, please support the VirtueMart project and become a member
Extensions approved by the core team: