Skip to content

Instantly share code, notes, and snippets.

@PululuK
Last active September 30, 2024 11:52
Show Gist options
  • Save PululuK/31a064e1d4a45ad9ede1f05480e1cdd0 to your computer and use it in GitHub Desktop.
Save PululuK/31a064e1d4a45ad9ede1f05480e1cdd0 to your computer and use it in GitHub Desktop.
Exemple implementation `ProductPresenterFactory`
<?php
function getPrestashopPresentedProduct(Context $context, array $product): ProductLazyArray
{
$productPresenterFactory= new ProductPresenterFactory($context);
$productPresenter = $productPresenterFactory->getPresenter();
$assembler = new ProductAssembler($context);
return $productPresenter->present(
$productPresenterFactory->getPresentationSettings(),
$assembler->assembleProduct($product),
$context->language
);
}
$myProductData = ['id_product' => 666, 'id_product_attribute' => 777];
$myPresentedProduct = getPrestashopPresentedProduct($context, $myProductData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment