coreshop / CoreShop

CoreShop - Pimcore enhanced eCommerce
http://www.coreshop.org
Other
277 stars 157 forks source link

[Coreshop 1] Error when viewing order details in demo #172

Closed Yivan closed 7 years ago

Yivan commented 7 years ago

Hello,

We encounter a bug on the detail page from the demo website installed on our server.

Step to reprodure: Install the last master for Corshop 1, demo and example website and bankwire. On the frontend website, create a user account and make an order. Going in "My Account", "Order History and Details" and clicking the "Show details" button bring an exception:

Call to undefined method getOrderStateHistory in class Pimcore\Model\Object\CoreShopOrder, coming from …/website/views/scripts/coreshop/template/default/scripts/coreshop/user/helper/order-detail.php, line 20.

Same problem with two fresh install on two totally different server (on on linux, the other on windows).

Thanks.

Yivan commented 7 years ago

After bypassing this error (by commenting the foreach loop sending the exception), we encountered another exception on this same order detail page:

Call to a member function getData() on array In …/plugins/CoreShop/lib/CoreShop/Model/Messaging/Thread.php, line 140

I think this part needs to be corrected too.

Yivan commented 7 years ago

I use this thread just for a side question please:

I see in the order detail that the product detail is directly the coreshop product and not a copy of it. Same in Pimcore backend order reference directly to the product object. Does it means, product can never be deleted ? Does coreshop implement or will (in CoreShop 2) a full copy of products data in the order as items like Magento does it for instance ?

Thanks a lot!

dpfaffenbauer commented 7 years ago

Hi,

both of your issues are fixed now.

Regarding Products: I already thought about the idea. But it comes with several problems.

One solution would be to not allow Products to be deleted where Orders exist?

Yivan commented 7 years ago

I think order product don't have to be displayed in frontend, or only when viewing cart order in the customer area. I don't think it should be synced... I see the order product like a snapshot when order is made. If original product is updated order product don't have to.

I know it is a really complexe subject, but seems pretty well handled on some other ecommerce solution (magento for instance). What i mean, is actually having catalogue product and order product the same source (called "product") prevent the catalogue from being updated without impacting already ordered product, it can be dangerous.

Maybe at least, it could be implemented some basic data for each ordered item which get copied, so even if the product is deleted, at least we keep tracking of the product. I think about the minimal, so shop manager can get what about is the ordered item even if the product has been deleted:

They are the only important field which can be used to regenerate invoice for instance (even 5 year after order, to respect some country legal disposition), even if product is no more in the catalog. I don't think main image and short description are needed.

Edit: i am not specialist of other ecommerce solution, but i think looking in the code of magento, prestashop and opencart, can bring some idea how deleting product and ordred items is handled.

dpfaffenbauer commented 7 years ago

Thats the Problem with Pimcore. As soon as you store a Product Object anywhere, it can get displayed in the frontend. Therefore, when copying a Product, we would need a flag "copied" or similar to hide it from navigation/index/detail page whatever. Easier solution would be a OrderProduct Object, therefore we would not have this problems. Or as you said, copy SKU/EAN and Product Name (maybe Short Description as well) to the OrderItem.

I will have a look at it in CoreShop 2.

solverat commented 7 years ago

Yes, @Yivan is right. we definitely need to go deeper into this subject. A ordered product should get stored detached from its original source. maybe as a object, serialized stored in a db / filesystem... i thinks it's definitely worth for another ticket.

dpfaffenbauer commented 7 years ago

there you go: https://github.com/coreshop/CoreShop/issues/174