Jump to content

Get product specific reference to module php file - PS 1.7.x


Recommended Posts

Hi,

Unfortunately in PS 1.7.x i can no longer include php in tpl files. I need to send (API) the specific product reference to a external server in order to get and display product stocks from the warehouses. 

I created a module and hooked it to displayProductAdditionalInfo, so far so good. 

I just need to send the specific product reference that the user is seeing on the website. Any way of achieving this? 

		$data = array(
			'cif'           => $companyVatCode,
			'date'          => date('Y-m-d'),
			'warehouseName' => '',
			'productName'   => '',
			'productCode'   => 'HERE I NEED THE PRODUCT SPECIFIC REFERENCE',	
		);
		try {
			$list = $sbcClient->productsStock($data);
			
			foreach($list as $item){
				foreach($item['products'] as $product){
					$wName = $item['warehouse']['warehouseName'];
					$codprod = $product['productCode'];
					$quantity = $product['quantity'];
					printf("%s%s%s%s%s%s%s".PHP_EOL,'<tr><td>',$wName,'</td><td>',$codprod,'</td><td>',$quantity,'</td></tr>');
				}
			}
		} 

If i manually register a code (ex: 'productCode'   => '5400852326801', ), then on the product page everything works fine:

sadasd.jpg.efd4b904262363544deff7f1a2171a97.jpg

Thanks!

 

 

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