Page 1 of 1

Publish products in frontend

Posted: 13 Jul 2016, 16:00
by earosb
Hey there,

We are using typo3 7.6.9 and aimeos 16.4.3. We have to add/create the product creation form in the fontend. is there a way to enable the basic mode in the frontend? somehow?

Thanks in advance!

Re: Publish products in frontend

Posted: 13 Jul 2016, 20:44
by aimeos
No, the admin interface is a backend module.

You should create a TYPO3 Extbase frontend plugin with a form for the product details you need, extend your Extbase controller from the Aimeos AbstractController and use the Aimeos product manager to create/update your products.

For the start in your controller action:

Code: Select all

$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );

Re: Publish products in frontend

Posted: 14 Jul 2016, 01:49
by earosb
aimeos wrote: You should create a TYPO3 Extbase frontend plugin with a form for the product details you need, extend your Extbase controller from the Aimeos AbstractController and use the Aimeos product manager to create/update your products.
I did exactly that (i tried), I created some managers for product, price, catalog, etc. but i don't understand how to attach a product with a price for example or how to create a product and see it in the catalog or the index staff.

Re: Publish products in frontend

Posted: 14 Jul 2016, 21:31
by aimeos
It's all about the lists, i.e. the list tables like mshop_product_list.

Use the product lists manager to create entries in the mshop_product_list table, use the product ID as parentid and the ID of the text/price/media as refid. The domain is text/price/media depending on the referenced item and the typeid is almost always the "default" code for the domain in the mshop_product_list_type table.

You can get the typeid via

Code: Select all

$listTypeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists/type' );
$textTypeId = $listTypeManager->findItem( 'default', array(), 'text' )->getId();
A product must be in a category to be visible, so add a list item to the category (catalog domain) using the product ID as refid. After everything is complete, the product must be added to the index with

Code: Select all

\Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->saveItem( $product );

Re: Publish products in frontend

Posted: 18 Jul 2016, 20:12
by earosb
aimeos wrote:A product must be in a category to be visible, so add a list item to the category (catalog domain) using the product ID as refid.
I almost got it, just one last question, how i add a list item to the category? i tried this

Code: Select all

$catalogListManager = \Aimeos\MShop\Factory::createManager( $context, 'catalog/lists' );
But the class Aimeos\MShop\Catalog\Manager\Lists\Standard it doesn't have a create or sets method
I'm still kinda confused with mshoplib, sorry

Re: Publish products in frontend

Posted: 18 Jul 2016, 22:10
by aimeos
Sure, they do! These methods are inherited via the base class.

Re: Publish products in frontend

Posted: 21 Jul 2016, 13:53
by earosb
aimeos wrote:Sure, they do! These methods are inherited via the base class.
I made it :D , tranks for the help!