Conversation
adriendupuis
left a comment
There was a problem hiding this comment.
The PHP API page content a lot of non PHP examples to move to Twig functions' pages.
It misses more link to navigate through the pages.
I added some PHP API Reference links (preview: https://ez-systems-developer-documentation--3122.com.readthedocs.build/en/3122/api/php_api/php_api_reference/namespaces/ibexa-contracts-connectorraptor.html).
docs/recommendations/raptor_integration/connector_installation_configuration.md
Outdated
Show resolved
Hide resolved
code_samples/recommendations/templates/themes/standard/pagelayout.html.twig
Outdated
Show resolved
Hide resolved
docs/templating/twig_function_reference/recommendations_twig_functions.md
Outdated
Show resolved
Hide resolved
docs/templating/twig_function_reference/recommendations_twig_functions.md
Outdated
Show resolved
Hide resolved
docs/templating/twig_function_reference/recommendations_twig_functions.md
Show resolved
Hide resolved
docs/templating/twig_function_reference/recommendations_twig_functions.md
Outdated
Show resolved
Hide resolved
adriendupuis
left a comment
There was a problem hiding this comment.
Few links to fix to get the preview again.
You can merge #3123 so you'll also have the 3 PHP API Ref pages used.
docs/templating/twig_function_reference/recommendations_twig_functions.md
Outdated
Show resolved
Hide resolved
docs/templating/twig_function_reference/recommendations_twig_functions.md
Outdated
Show resolved
Hide resolved
docs/recommendations/raptor_integration/raptor_connector_guide.md
Outdated
Show resolved
Hide resolved
* Add preview of linked PHP API Ref entries * Fix few links
|
code_samples/ change report
|
| <php> | ||
| use Ibexa\Contracts\ConnectorRaptor\Tracking\Event\VisitEventData; | ||
|
|
||
| $eventData = new VisitEventData( | ||
| productCode: $product->getCode(), | ||
| productName: $product->getName(), | ||
| categoryPath: '25#Electronics;26#Smartphones', // Build manually | ||
| currency: 'USD', | ||
| itemPrice: '999.99' | ||
| ); | ||
|
|
||
| $this->trackingDispatcher->dispatch($eventData); | ||
| </php> |
There was a problem hiding this comment.
<php> is not a correct markup for PHP code. Is this something related to ReadTheDocs embedding?
There was a problem hiding this comment.
No, this is incorrect - these files should be just valid PHP codes for PHPStan to verify them.
See https://github.com/ibexa/documentation-developer/blob/5.0/code_samples/api/public_php_api/src/embedding_fields.php or https://github.com/ibexa/documentation-developer/blob/5.0/code_samples/api/commerce/src/Command/CartCommand.php for examples
This applies to all PHP samples
| <p>Quantity: {{ addedQuantity }}</p> | ||
| </div> | ||
|
|
||
| {# Build basket content string: "SKU:quantity;SKU:quantity" #} |
There was a problem hiding this comment.
| {# Build basket content string: "SKU:quantity;SKU:quantity" #} | |
| {# Build basket content string: "product-code:quantity;product-code:quantity" #} |
|
|
||
| # Configuration procedure | ||
|
|
||
| To configure the Raptor integration, follow a step-by-step procedure that allows you to activate the Raptor connector. |
There was a problem hiding this comment.
| To configure the Raptor integration, follow a step-by-step procedure that allows you to activate the Raptor connector. | |
| To configure the Raptor integration, follow the step-by-step procedure described below. |
| {# If you have a custom Twig filter to format basket content #} | ||
| {% set basketContext = { | ||
| 'basketContent': basket|format_basket_content, {# Returns "SKU-1:2;SKU-2:1;SKU-3:5" #} | ||
| 'basketId': basket.id, |
There was a problem hiding this comment.
In case of our API, here we would usually use the Cart object?
I mean, we're calling it "cart" consistently in the docs and in the code:
https://doc.ibexa.co/en/5.0/commerce/cart/cart/
and IMHO the code samples should transition from cart (DXP terminlogy) to basket (Raptor terminilogy), showing how these two are connected.
| @@ -0,0 +1,8 @@ | |||
| {# If you have a custom Twig filter to format basket content #} | |||
| {% set basketContext = { | |||
| 'basketContent': basket|format_basket_content, {# Returns "SKU-1:2;SKU-2:1;SKU-3:5" #} | |||
There was a problem hiding this comment.
Usually we use product code instead of SKU
| <php> | ||
| use Ibexa\Contracts\ConnectorRaptor\Tracking\Event\VisitEventData; | ||
|
|
||
| $eventData = new VisitEventData( | ||
| productCode: $product->getCode(), | ||
| productName: $product->getName(), | ||
| categoryPath: '25#Electronics;26#Smartphones', // Build manually | ||
| currency: 'USD', | ||
| itemPrice: '999.99' | ||
| ); | ||
|
|
||
| $this->trackingDispatcher->dispatch($eventData); | ||
| </php> |
There was a problem hiding this comment.
No, this is incorrect - these files should be just valid PHP codes for PHPStan to verify them.
See https://github.com/ibexa/documentation-developer/blob/5.0/code_samples/api/public_php_api/src/embedding_fields.php or https://github.com/ibexa/documentation-developer/blob/5.0/code_samples/api/commerce/src/Command/CartCommand.php for examples
This applies to all PHP samples
| private ServerSideTrackingDispatcherInterface $trackingDispatcher, | ||
| ) {} | ||
|
|
||
| public function trackProductView(ProductInterface $product, string $url): void |
There was a problem hiding this comment.
This one should fail on PHPStan, as ProductInterface is not defined - incorrect code sample
|
|
||
| ### Basket event | ||
|
|
||
| This event tracks when a product is added to the shopping basket. |
There was a problem hiding this comment.
| This event tracks when a product is added to the shopping basket. | |
| This event tracks when a product is added to the [cart](cart.md). |
| Required data: | ||
|
|
||
| - **Product object** - defines the product being added to the basket. | ||
| - **Context array with basket information** - provides optional data about the basket, like quantity or basket ID, to provide context for the event. |
There was a problem hiding this comment.
| - **Context array with basket information** - provides optional data about the basket, like quantity or basket ID, to provide context for the event. | |
| - **Context array with cart information** - provides optional data about the cart, like product quantity or cart identifier, to provide context for the event. |
| [[= include_file('code_samples/recommendations/events/basket_event.html.twig') =]] | ||
| ``` | ||
|
|
||
| Simplified example with Twig filter: |
There was a problem hiding this comment.
Not a fan of this example, it's "here's how simple it could be if you write your custom code to make it simpler". If this is useful, would be nice to provide this out of the box - I believe Partners are aware that they can create their own helpers when needed.
I'd just remove this TBH
|
|
||
| #### Tracking events | ||
|
|
||
| The following events are supported and can be triggered from Twig templates: |
There was a problem hiding this comment.
Is itemclicked and buy not supported? They are not on this list




Checklist