Jump to content

Add product features in the Invoice - get product features


steinsgate

Recommended Posts

Hi,

 

I am trying to put additional information in the invoice, manufacturer and a feature "internalcode".

 

I have SKU and "internalcode" as a features, imported using a products CSV file.

 

My problem is I cannot get product features when generating the PDF, or from any other place except the Product controller. In the Order controller the attributes I have for a product are the basic so I don't have custom features.

 

I didn't see any way to get products by id like "getProductById($id)", but I see there is a getProductByReference(). How can I get a product with ALL attributes and features from a controller other than ProductController or from a class, I don't have to use it from a template just create the PDF in my case.

 

Editing PDF.php in line ~945 I try to put something like:

 

// get features
$internalcode=Product::getByReference($product['product_reference'])->getFrontFeatures(1);

foreach ($internalcode as $feature){
 if ($feature['name']=="internalcode") {
		    $id=$feature['value'];
   }
}

 

But even getting the features in the array, I get an error when I call getFrontFeatures or any similar method (I tried with static and non static methods, creating a Product, etc.).

 

I used getFeatures() also but I cannot get the features, sometimes I get an array with the attributes but also an error, saying that I cannot call the method, but it's working. However, I cannot get the PDF because of the error.

 

If someone can give me some information for

  1. Get features for a product selected by reference or id from any controller.
  2. Add product features in the Invoice.
  3. Select products by id.
  4. Select all products from an invoice with all attributes as a product objects.

Will be useful and will solve this problem.

 

 

All comments will be appreciated.

 

Thanks in advance.

Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

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