Last active
September 30, 2024 11:52
-
-
Save PululuK/31a064e1d4a45ad9ede1f05480e1cdd0 to your computer and use it in GitHub Desktop.
Exemple implementation `ProductPresenterFactory`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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