Jump to content

[SOLVED] Product object added property not seen in Shopping cart


MrBaseball34

Recommended Posts

I've added a property to the Product Object to handle our images, it is called hack_image.
Now, when a New product OBJECT is created, it is populated with the correct value from the DB.

But, when I get in the shopping-cart-product-line template, the variable $product is an array, not an object
and my hack_image value is no longer there.

I've looked high and low for when this array is built.

Oh, and another thing, Why would some properties sometimes be accessed like this:

$product->name

and other times accessed like this:

$product.name

Can anyone help out??

Link to comment
Share on other sites

In PrestaShop, the Product class is only called in product.php to get an individual product. Anywhere that PrestaShop needs to get multiple products, an SQL query is performed instead of creating Product objects, then the Product::getProductProperties() function is called on each row in the result. I think you'll need to modify all the SQL queries to include your image_hack field.

Link to comment
Share on other sites

Every place that it selects product(s) in the Product class, it uses p.* so the hack_image column *should* be included.
I can't seem to find any SQL selecting any products that doesn't include all columns, with the exception of getting the quantity and
finding out if a product is new...

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...