Supplier Information in Products Detail, Basket and Billing
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 9
- Joined: 19 Mar 2019, 06:54
Supplier Information in Products Detail, Basket and Billing
Dear All,
I am a bloody beginner in extending Aimeos - I am Using Typo3 8.7.22, PHP 7.2.16 and Aimeos 18.10.0.
One of my biggest challanges for now is to get the Supplier-information into the Product's Detail Pages.
In our Shop-System, we only have one Supplier per Product, so there is always just a 1:1 Relation in theory.
Now I would need to get the Image of the supplier into the Product's Detail Page, so a Customer can see, where the product is manufactured, and the Code into the Basket and the order.
I Tried it with following Code in the Products "body-standard" Template, but I always get an Error:
The Error is as follows:
Oops, an error occurred!
Class "\Aimeos\MW\View\Helper\GetContext\Standard" not available
I always read something about putting Codes like this into Controllers, but i really have no idea, which controllers are meant and how i can get it in there.
I hope, someone can help me on that.
Best regards and Thank you,
Izaquiel
I am a bloody beginner in extending Aimeos - I am Using Typo3 8.7.22, PHP 7.2.16 and Aimeos 18.10.0.
One of my biggest challanges for now is to get the Supplier-information into the Product's Detail Pages.
In our Shop-System, we only have one Supplier per Product, so there is always just a 1:1 Relation in theory.
Now I would need to get the Image of the supplier into the Product's Detail Page, so a Customer can see, where the product is manufactured, and the Code into the Basket and the order.
I Tried it with following Code in the Products "body-standard" Template, but I always get an Error:
Code: Select all
$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier' );
$search = $manager->createSearch( true );
$expr = array(
$search->compare( '==', 'supplier.lists.refid', $product->getProductId() ),
$search->compare( '==', 'supplier.lists.domain', 'product' ),
$search->getConditions(),
);
$search->setConditions( $search->combine( '&&', $expr ) );
print_r( $manager->searchItems( $search ) );
Oops, an error occurred!
Class "\Aimeos\MW\View\Helper\GetContext\Standard" not available
I always read something about putting Codes like this into Controllers, but i really have no idea, which controllers are meant and how i can get it in there.
I hope, someone can help me on that.
Best regards and Thank you,
Izaquiel
Re: Supplier Information in Products Detail, Basket and Bill
Hi Izaquiel,
you need to put this kind of logic into a Decorator and send your query result as a view variable like explained here:
https://aimeos.org/docs/Developers/Html ... components
Best
Robert.
you need to put this kind of logic into a Decorator and send your query result as a view variable like explained here:
https://aimeos.org/docs/Developers/Html ... components
Best
Robert.
-
- Posts: 9
- Joined: 19 Mar 2019, 06:54
Re: Supplier Information in Products Detail, Basket and Bill
Hello Robert,
thx for that quick support.
So, know i got the Decorator integrated and recognized by my Template.
But i can'T figure out, how I can access the Data. Maybe you can Help me with that?
Thanks and best Regards,
Izaquiel
thx for that quick support.
So, know i got the Decorator integrated and recognized by my Template.
But i can'T figure out, how I can access the Data. Maybe you can Help me with that?
Thanks and best Regards,
Izaquiel
Re: Supplier Information in Products Detail, Basket and Bill
You are welcome!
you have to assign your variables or query results to the view like so:
In your template the variable is available as $myQueryresult afterwards. Also be aware when using partials to hand them over from the parent template to the partial as they aren´t available publicly by default.
you have to assign your variables or query results to the view like so:
Code: Select all
$view->myQueryresult = $manager->searchItems( $search )
-
- Posts: 9
- Joined: 19 Mar 2019, 06:54
Re: Supplier Information in Products Detail, Basket and Bill
Ok, thank you - seams to work "a little bit".
So, if i comment out the PArts, wehre i search for the Product ID relation, i get a "NULL", when i var_dump the $myQueryresult Variable.
When i use those 2 lines of Code, i get the Error
Oops, an error occurred!
Call to a member function getProductId() on null
which seems logical to my, but how can i get the Product ID into the Query?
Thx again
So, if i comment out the PArts, wehre i search for the Product ID relation, i get a "NULL", when i var_dump the $myQueryresult Variable.
When i use those 2 lines of Code, i get the Error
Oops, an error occurred!
Call to a member function getProductId() on null
which seems logical to my, but how can i get the Product ID into the Query?
Thx again
Re: Supplier Information in Products Detail, Basket and Bill
The id should be available here:
If you are in search for what is available in the Client you are working on it may help to look into the Client class you are writing your decorator for:
typo3conf/ext/aimeos/Resources/Private/Extensions/ai-client-html/client/html/src/Client/Html/Catalog/Detail/Standard.php
Code: Select all
$prodid = $view->param( 'd_prodid' );
typo3conf/ext/aimeos/Resources/Private/Extensions/ai-client-html/client/html/src/Client/Html/Catalog/Detail/Standard.php
-
- Posts: 9
- Joined: 19 Mar 2019, 06:54
Re: Supplier Information in Products Detail, Basket and Bill
Big, big thanks ... it's works
Re: Supplier Information in Products Detail, Basket and Bill
Great, nice to hear.
-
- Posts: 9
- Joined: 19 Mar 2019, 06:54
Re: Supplier Information in Products Detail, Basket and Bill
Ok - so i am standing at the next point:
The Basket. There is, as i saw in a var_dump a field called "suppliercode" for each product, but that is ALWAYS NULL.
So, in my Product Detail Page i got the Supplier Infos as I wanted them. But in Basket (and the Order-Details in Backend for Invoicing) i still need to get the Suppliercode (as it is used as a Reference for the Shop-Owner to it's different branches) into the Output of each Product.
Do I need a Decorator too for this? Or how is the Field "Suppliercode" used here?
Best regards and thanks
The Basket. There is, as i saw in a var_dump a field called "suppliercode" for each product, but that is ALWAYS NULL.
So, in my Product Detail Page i got the Supplier Infos as I wanted them. But in Basket (and the Order-Details in Backend for Invoicing) i still need to get the Suppliercode (as it is used as a Reference for the Shop-Owner to it's different branches) into the Output of each Product.
Do I need a Decorator too for this? Or how is the Field "Suppliercode" used here?
Best regards and thanks
Re: Supplier Information in Products Detail, Basket and Bill
Hi Izaquiel,
yes I would suggest a Decroator, at least for digging deeper.
You are looking for properties of:
typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/src/MShop/Order/Manager/Base/Product/Standard.php
I would try and place your decorator here to have it available in checkout
Try an look what extOrderBaseItem gives you back:
Didn´t try it myself though.
Cheers
Robert.
yes I would suggest a Decroator, at least for digging deeper.
You are looking for properties of:
typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/src/MShop/Order/Manager/Base/Product/Standard.php
I would try and place your decorator here to have it available in checkout
Code: Select all
checkout {
standard {
decorators {
global {
0 = Yourdecorator
}
}
}
}
Code: Select all
$view->extOrderBaseItem->toArray();
Cheers
Robert.