Share » Forums » Setup & design » Order 2 products at the same time

Order 2 products at the same time

Order 2 products at the same time

Tuesday 12 July 2005 8:55:16 am - 5 replies

Author Message

Mads Ovesen

Wednesday 28 September 2005 6:41:02 am

Hi Bertrand,
I'm in need of the same kind of solution. I have no better solution than the one suggested. It seems like the most reasonable way to do it. Did you make it work??

- Mads

/m

Bertrand Dunogier

Wednesday 28 September 2005 6:55:12 am

Yes, I have a working solution.

It's a light hack on the AddToBasket action. It allows you to define options using a subindex, like

eZOption[set_right][2010]

if eZOption[set_right][2010] and eZOption[set_left][2010] are different, 2 products are added, otherwise one is added.

I can provide you with the patch if you want, but it comes with no warranty ;)

Mads Ovesen

Wednesday 28 September 2005 7:25:50 am

Thanks. I would like to see the patch, so I can modify it to fit my needs.

/m

Xavier Dutoit

Monday 03 October 2005 1:07:15 am

It also would be great if you could post the diff in this thread for later reference...

X+

http://www.sydesy.com

Bertrand Dunogier

Tuesday 04 October 2005 5:00:38 am

Here is the patch for eZ Publish 3.6.0 stable

--- kernel/shop/ezshopoperationcollection.orig.php      2005-10-04 13:50:53.000000000 +0200
+++ kernel/shop/ezshopoperationcollection.php   2005-08-19 14:28:12.000000000 +0200
@@ -88,6 +88,18 @@
             eZDebug::writeError( 'Attempted to add object without price to basket.' );
             return array( 'status' => EZ_MODULE_OPERATION_CANCELED );
         }
+
+        /* Check if options are part of a set */
+        $set = false;
+        foreach ( array_keys( $optionList ) as $optionKey ) {
+            if ( substr( $optionKey, 0, 4 ) == 'set_' ) {
+                $returnStatus = eZShopOperationCollection::addToBasket( $objectID, $optionList[$optionKey] );
+                $set = true;
+            }
+        }
+        if ( $set )
+            return array( 'status' => $returnStatus );
+
         $basket =& eZBasket::currentBasket();
 
         /* Check if the item with the same options is not already in the basket: */

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu