cancel
Showing results for 
Search instead for 
Did you mean: 

Error on getData to _product()

SOLVED

Error on getData to _product()

 

 

<?php $vezes = $_product->getData('parcelas'); ?>
<?php echo $_coreHelper->formatPrice($_regularPrice, false).'</span><span class="descricao_x"> até '.$vezes.'x de '.$_coreHelper->currency($_product->getPrice()/$vezes, true, false).'</span>';?>

Hello everyone, I created an attribute called "parcelas". I write the value of the attribute in the product.
In example "12" x.
But on the product screen it works fine (correct) parcela_02.png

 

 

 

 

but when it is listed in the category (Hardware and others) it can not pull the "parcelas" value for the "price / parcel" calculation formula (265.00 / 12).(wrong)parcela_01.png

What happens in this case? Why does it show one way or the other? by the tests that I did the problem is in the "parcelas"  that comes with value zero and does not generate the result.
if I replace the cod.

<?php $vezes = $_product->getData('parcelas'); ?>
to
<?php $vezes = '12'; ?>

It works in both cases, but I can not leave it because the value of the attribute must be different for each product.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Error on getData to _product()

Hi @fabio_marcelo,

 

You should change the attribute configuration. Take a look to the "Used on product listing" option. It should say "Yes".

Here you'll find more information about attribute configurations and options: http://docs.magento.com/m1/ce/user_guide/catalog/attribute-frontend-properties.html

View solution in original post

5 REPLIES 5

Re: Error on getData to _product()

Hi @fabio_marcelo,

 

Maybe is a a configuration issue.

Can you share the attribute configuration?

Re: Error on getData to _product()

parcela_03.png

Tks for help. if it is attribute error, pq appears correct in one view and the other does not? 

Re: Error on getData to _product()

To complete..... 
I find the file that calls the price for the parts with error .. in file \template\common\list\default.phtml  of the theme,

<?php if($show_price): ?>
          <div class="price">
	      <?php echo $this->getPriceHtml($_product, true, $price_prefix)?>
	  </div>
<?php endif; ?>

so why not accept the variable $vezes of the price.phtml?


Re: Error on getData to _product()

Hi @fabio_marcelo,

 

You should change the attribute configuration. Take a look to the "Used on product listing" option. It should say "Yes".

Here you'll find more information about attribute configurations and options: http://docs.magento.com/m1/ce/user_guide/catalog/attribute-frontend-properties.html

Re: Error on getData to _product()

ThankYou man !