Jump to content

extend productlazyarray | add property to cart product


seb776

Recommended Posts

Hello,

I want to add a information on cart page.
I'd like to display if a product is payed or offered (discount free gift).

So, I added the information on the template .

{$product.gift}

 

But the property is not defined.
 

So I added, the proper property in ProductLazyArray.php

/**
* @arrayAccess
* @return string */
public function getGift()
{
   return 'gift';
}

 

if I dump the data after the AbstractLazyArray constructor, the gift property is here. ok.

But when accessing it, it is not in the index, despite my code editor does not find any other modification of $this->arrayAccessList .

So {$product.gift} is always empty ...

What am I missing ??

(I know changing core files is not a good practice, how should I do it correctly ?)

Edited by seb776 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...