[Skip to main content](#vessel-content)

#  Profile for erhartm

##

[![erhartm's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/33354-erhartm "View erhartm's Profile")

**[ Offline](/forum/user/33354-erhartm)**

- **User Type:** User

- **Register Date:** 09 Jul 2014
- **Last login:** 11 years 11 months ago
- **Time Zone:**  UTC +0:00
- **Local Time:** 10:35

- **Posts:** 13
- **Profile views:** 77
- **Thank you received:** 2

- **Gender:** Unknown
- **Birthdate:** Unknown

- Posts

#  erhartm's recent posts  (13 messages )

All Since last visit 4 Hours 8 Hours 12 Hours 24 Hours 48 Hours Week Month Year     All Since last visit 4 Hours 8 Hours 12 Hours 24 Hours 48 Hours Week Month Year

| <a id="forumtop"> </a> [  ](#forumbottom) | Subject | Replies / Views | Last Post | <a id="forumbottom"> </a> [   ](#forumtop) |
|---|---|---|---|---|
| [](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485) | [Clear cart before a certain product is added](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "-- HikaShop version -- : current -- Joomla version -- : current 3.3 -- PHP version -- : current  hi!  I would like to create a plugin that does something when a product is added to the cart:  - It should check whether the product is part of a certain category. If this is the case, the plugin should empty the cart and then add the product to the cart, making it the only product in the cart  - If a certain product is added to the cart, it should change the shop's currency  Right now, I am working on the first part, but I do not even manage to make the cart get cleared for every product added. What I tried is this:  It clears the cart, but the product is not added afterwards. Can somebody please guide me on what I am doing wrong here? Additionally, I would greatly appreciate if you could tell me how to check if a certain product is part of a certain category.  Thank you very much &amp; all the best,  Lukas")        Category: [Development](/forum/31-development "If you are developping a plugin for Hikashop or customizing our component, this is the board to be.")     Topic started 12 years 2 months ago, by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")       [Last Post](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "just for others if you have a similar problem - I did it this way (it also changes the currency if certain products are added):  function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product&#95;id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $app=&amp;JFactory::getApplication(); $pointProducts=array(4,5,6,7); if (in&#95;array($product&#95;id,$pointProducts)) { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',1); } else { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',182); } $full = $cartClass-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $first=array&#95;shift(array&#95;values($rows)); if ($first-&gt;product&#95;id==$product&#95;id) { $do=false; return false; } else { $cartClass-&gt;resetCart(false); $cart=$cartClass-&gt;initCart(); $do=true; return true; } }") 12 years 1 month ago     by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile") | Replies:8  Views:1277 | [Last Post](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "just for others if you have a similar problem - I did it this way (it also changes the currency if certain products are added):  function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product&#95;id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $app=&amp;JFactory::getApplication(); $pointProducts=array(4,5,6,7); if (in&#95;array($product&#95;id,$pointProducts)) { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',1); } else { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',182); } $full = $cartClass-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $first=array&#95;shift(array&#95;values($rows)); if ($first-&gt;product&#95;id==$product&#95;id) { $do=false; return false; } else { $cartClass-&gt;resetCart(false); $cart=$cartClass-&gt;initCart(); $do=true; return true; } }") by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")      12 years 1 month ago |
| [](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169135) | [Clear cart before a certain product is added](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169135 "-- HikaShop version -- : current -- Joomla version -- : current 3.3 -- PHP version -- : current  hi!  I would like to create a plugin that does something when a product is added to the cart:  - It should check whether the product is part of a certain category. If this is the case, the plugin should empty the cart and then add the product to the cart, making it the only product in the cart  - If a certain product is added to the cart, it should change the shop's currency  Right now, I am working on the first part, but I do not even manage to make the cart get cleared for every product added. What I tried is this:  It clears the cart, but the product is not added afterwards. Can somebody please guide me on what I am doing wrong here? Additionally, I would greatly appreciate if you could tell me how to check if a certain product is part of a certain category.  Thank you very much &amp; all the best,  Lukas")        Category: [Development](/forum/31-development "If you are developping a plugin for Hikashop or customizing our component, this is the board to be.")     Topic started 12 years 2 months ago, by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")       [Last Post](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "just for others if you have a similar problem - I did it this way (it also changes the currency if certain products are added):  function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product&#95;id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $app=&amp;JFactory::getApplication(); $pointProducts=array(4,5,6,7); if (in&#95;array($product&#95;id,$pointProducts)) { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',1); } else { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',182); } $full = $cartClass-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $first=array&#95;shift(array&#95;values($rows)); if ($first-&gt;product&#95;id==$product&#95;id) { $do=false; return false; } else { $cartClass-&gt;resetCart(false); $cart=$cartClass-&gt;initCart(); $do=true; return true; } }") 12 years 1 month ago     by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile") | Replies:8  Views:1277 | [Last Post](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "just for others if you have a similar problem - I did it this way (it also changes the currency if certain products are added):  function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product&#95;id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $app=&amp;JFactory::getApplication(); $pointProducts=array(4,5,6,7); if (in&#95;array($product&#95;id,$pointProducts)) { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',1); } else { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',182); } $full = $cartClass-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $first=array&#95;shift(array&#95;values($rows)); if ($first-&gt;product&#95;id==$product&#95;id) { $do=false; return false; } else { $cartClass-&gt;resetCart(false); $cart=$cartClass-&gt;initCart(); $do=true; return true; } }") by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")      12 years 1 month ago |
| [](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168682) | [Userpoints earning fails on empty custom field](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168682 "-- url of the page with the problem -- :   www.ready-to-win.com/rtw14/  -- HikaShop version -- : 2.3.2 -- Joomla version -- : 3.3.3 -- PHP version -- : latest  Hi,  I found a bug in the Userpoints module. When a new user is created, his user points field is not 0, but empty. If the userpoints plugin then tries to add earned points to the account, it fails. It seems that the isset function returns false, even though it should return true.  plg&#95;hikashop&#95;userpoints --&gt; userpoints.php  I changed line 263 to this:  if(!isset($oldUser-&gt;user&#95;points)) $oldUser-&gt;user&#95;points = 0;  Now it works, but it is more a quick fix than a solution.  All the best,  Lukas")        Category: [Development](/forum/31-development "If you are developping a plugin for Hikashop or customizing our component, this is the board to be.")     Topic started 12 years 2 months ago, by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")       [Last Post](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168700 "Hi,  is&#95;null will create a &quot;notice&quot; if the &quot;user&#95;points&quot; really does not exists. So I will prefer something likeOrDepending if we want to keep the PHP4 compatibility for Joomla 1.5 users.  Regards,") 12 years 2 months ago     by [Jerome](/forum/user/80-jerome "View Jerome's Profile") | Replies:4  Views:1118 | [Last Post](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168700 "Hi,  is&#95;null will create a &quot;notice&quot; if the &quot;user&#95;points&quot; really does not exists. So I will prefer something likeOrDepending if we want to keep the PHP4 compatibility for Joomla 1.5 users.  Regards,") by [Jerome](/forum/user/80-jerome "View Jerome's Profile")      12 years 2 months ago |
| [](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168681) | [Userpoints earning fails on empty custom field](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168681 "-- url of the page with the problem -- :   www.ready-to-win.com/rtw14/  -- HikaShop version -- : 2.3.2 -- Joomla version -- : 3.3.3 -- PHP version -- : latest  Hi,  I found a bug in the Userpoints module. When a new user is created, his user points field is not 0, but empty. If the userpoints plugin then tries to add earned points to the account, it fails. It seems that the isset function returns false, even though it should return true.  plg&#95;hikashop&#95;userpoints --&gt; userpoints.php  I changed line 263 to this:  if(!isset($oldUser-&gt;user&#95;points)) $oldUser-&gt;user&#95;points = 0;  Now it works, but it is more a quick fix than a solution.  All the best,  Lukas")        Category: [Development](/forum/31-development "If you are developping a plugin for Hikashop or customizing our component, this is the board to be.")     Topic started 12 years 2 months ago, by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")       [Last Post](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168700 "Hi,  is&#95;null will create a &quot;notice&quot; if the &quot;user&#95;points&quot; really does not exists. So I will prefer something likeOrDepending if we want to keep the PHP4 compatibility for Joomla 1.5 users.  Regards,") 12 years 2 months ago     by [Jerome](/forum/user/80-jerome "View Jerome's Profile") | Replies:4  Views:1118 | [Last Post](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168700 "Hi,  is&#95;null will create a &quot;notice&quot; if the &quot;user&#95;points&quot; really does not exists. So I will prefer something likeOrDepending if we want to keep the PHP4 compatibility for Joomla 1.5 users.  Regards,") by [Jerome](/forum/user/80-jerome "View Jerome's Profile")      12 years 2 months ago |
| [](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168646) | [Userpoints earning fails on empty custom field](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168646 "-- url of the page with the problem -- :   www.ready-to-win.com/rtw14/  -- HikaShop version -- : 2.3.2 -- Joomla version -- : 3.3.3 -- PHP version -- : latest  Hi,  I found a bug in the Userpoints module. When a new user is created, his user points field is not 0, but empty. If the userpoints plugin then tries to add earned points to the account, it fails. It seems that the isset function returns false, even though it should return true.  plg&#95;hikashop&#95;userpoints --&gt; userpoints.php  I changed line 263 to this:  if(!isset($oldUser-&gt;user&#95;points)) $oldUser-&gt;user&#95;points = 0;  Now it works, but it is more a quick fix than a solution.  All the best,  Lukas")        Category: [Development](/forum/31-development "If you are developping a plugin for Hikashop or customizing our component, this is the board to be.")     Topic started 12 years 2 months ago, by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")       [Last Post](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168700 "Hi,  is&#95;null will create a &quot;notice&quot; if the &quot;user&#95;points&quot; really does not exists. So I will prefer something likeOrDepending if we want to keep the PHP4 compatibility for Joomla 1.5 users.  Regards,") 12 years 2 months ago     by [Jerome](/forum/user/80-jerome "View Jerome's Profile") | Replies:4  Views:1118 | [Last Post](/forum/31-development/870567-userpoints-earning-fails-on-empty-custom-field#168700 "Hi,  is&#95;null will create a &quot;notice&quot; if the &quot;user&#95;points&quot; really does not exists. So I will prefer something likeOrDepending if we want to keep the PHP4 compatibility for Joomla 1.5 users.  Regards,") by [Jerome](/forum/user/80-jerome "View Jerome's Profile")      12 years 2 months ago |
| [](/forum/27-checkout/866056-display-prices-only-in-their-currency-of#168476) | [Display prices only in their currency of](/forum/27-checkout/866056-display-prices-only-in-their-currency-of#168476 "Hello, I need to show only the price in the currency specified in settings ( each item separately).  1. If the product is worth the price of 10 Euro is to show only this price without conversion to base currency store (which is set as the main settings );  2 . If the setting is worth the price shipping method delivery $ 5 (USD), then to ordering to only have this price , without conversion to Euro ( if the Euro is the main currency of the site).  Please tell me how to do it ?")        Category: [Checkout](/forum/27-checkout "Everything about the checkout process in Hikashop")     Topic started 12 years 8 months ago, by [Premier](/forum/user/31202-premier "View Premier's Profile")       [Last Post](/forum/27-checkout/866056-display-prices-only-in-their-currency-of#198997 "Hello, If you want to do the same thing you'll probably just have to reproduce and test what Nicolas and Xavier said.") 11 years 6 months ago     by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile") | Replies:9  Views:2200 | [Last Post](/forum/27-checkout/866056-display-prices-only-in-their-currency-of#198997 "Hello, If you want to do the same thing you'll probably just have to reproduce and test what Nicolas and Xavier said.") by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")      11 years 6 months ago |
| [](/forum/27-checkout/866056-display-prices-only-in-their-currency-of#168378) | [Display prices only in their currency of](/forum/27-checkout/866056-display-prices-only-in-their-currency-of#168378 "Hello, I need to show only the price in the currency specified in settings ( each item separately).  1. If the product is worth the price of 10 Euro is to show only this price without conversion to base currency store (which is set as the main settings );  2 . If the setting is worth the price shipping method delivery $ 5 (USD), then to ordering to only have this price , without conversion to Euro ( if the Euro is the main currency of the site).  Please tell me how to do it ?")        Category: [Checkout](/forum/27-checkout "Everything about the checkout process in Hikashop")     Topic started 12 years 8 months ago, by [Premier](/forum/user/31202-premier "View Premier's Profile")       [Last Post](/forum/27-checkout/866056-display-prices-only-in-their-currency-of#198997 "Hello, If you want to do the same thing you'll probably just have to reproduce and test what Nicolas and Xavier said.") 11 years 6 months ago     by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile") | Replies:9  Views:2200 | [Last Post](/forum/27-checkout/866056-display-prices-only-in-their-currency-of#198997 "Hello, If you want to do the same thing you'll probably just have to reproduce and test what Nicolas and Xavier said.") by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")      11 years 6 months ago |
| [](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#168322) | [Clear cart before a certain product is added](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#168322 "-- HikaShop version -- : current -- Joomla version -- : current 3.3 -- PHP version -- : current  hi!  I would like to create a plugin that does something when a product is added to the cart:  - It should check whether the product is part of a certain category. If this is the case, the plugin should empty the cart and then add the product to the cart, making it the only product in the cart  - If a certain product is added to the cart, it should change the shop's currency  Right now, I am working on the first part, but I do not even manage to make the cart get cleared for every product added. What I tried is this:  It clears the cart, but the product is not added afterwards. Can somebody please guide me on what I am doing wrong here? Additionally, I would greatly appreciate if you could tell me how to check if a certain product is part of a certain category.  Thank you very much &amp; all the best,  Lukas")        Category: [Development](/forum/31-development "If you are developping a plugin for Hikashop or customizing our component, this is the board to be.")     Topic started 12 years 2 months ago, by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")       [Last Post](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "just for others if you have a similar problem - I did it this way (it also changes the currency if certain products are added):  function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product&#95;id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $app=&amp;JFactory::getApplication(); $pointProducts=array(4,5,6,7); if (in&#95;array($product&#95;id,$pointProducts)) { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',1); } else { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',182); } $full = $cartClass-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $first=array&#95;shift(array&#95;values($rows)); if ($first-&gt;product&#95;id==$product&#95;id) { $do=false; return false; } else { $cartClass-&gt;resetCart(false); $cart=$cartClass-&gt;initCart(); $do=true; return true; } }") 12 years 1 month ago     by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile") | Replies:8  Views:1277 | [Last Post](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "just for others if you have a similar problem - I did it this way (it also changes the currency if certain products are added):  function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product&#95;id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $app=&amp;JFactory::getApplication(); $pointProducts=array(4,5,6,7); if (in&#95;array($product&#95;id,$pointProducts)) { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',1); } else { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',182); } $full = $cartClass-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $first=array&#95;shift(array&#95;values($rows)); if ($first-&gt;product&#95;id==$product&#95;id) { $do=false; return false; } else { $cartClass-&gt;resetCart(false); $cart=$cartClass-&gt;initCart(); $do=true; return true; } }") by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")      12 years 1 month ago |
| [](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#168060) | [Clear cart before a certain product is added](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#168060 "-- HikaShop version -- : current -- Joomla version -- : current 3.3 -- PHP version -- : current  hi!  I would like to create a plugin that does something when a product is added to the cart:  - It should check whether the product is part of a certain category. If this is the case, the plugin should empty the cart and then add the product to the cart, making it the only product in the cart  - If a certain product is added to the cart, it should change the shop's currency  Right now, I am working on the first part, but I do not even manage to make the cart get cleared for every product added. What I tried is this:  It clears the cart, but the product is not added afterwards. Can somebody please guide me on what I am doing wrong here? Additionally, I would greatly appreciate if you could tell me how to check if a certain product is part of a certain category.  Thank you very much &amp; all the best,  Lukas")        Category: [Development](/forum/31-development "If you are developping a plugin for Hikashop or customizing our component, this is the board to be.")     Topic started 12 years 2 months ago, by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")       [Last Post](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "just for others if you have a similar problem - I did it this way (it also changes the currency if certain products are added):  function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product&#95;id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $app=&amp;JFactory::getApplication(); $pointProducts=array(4,5,6,7); if (in&#95;array($product&#95;id,$pointProducts)) { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',1); } else { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',182); } $full = $cartClass-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $first=array&#95;shift(array&#95;values($rows)); if ($first-&gt;product&#95;id==$product&#95;id) { $do=false; return false; } else { $cartClass-&gt;resetCart(false); $cart=$cartClass-&gt;initCart(); $do=true; return true; } }") 12 years 1 month ago     by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile") | Replies:8  Views:1277 | [Last Post](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "just for others if you have a similar problem - I did it this way (it also changes the currency if certain products are added):  function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product&#95;id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $app=&amp;JFactory::getApplication(); $pointProducts=array(4,5,6,7); if (in&#95;array($product&#95;id,$pointProducts)) { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',1); } else { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',182); } $full = $cartClass-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $first=array&#95;shift(array&#95;values($rows)); if ($first-&gt;product&#95;id==$product&#95;id) { $do=false; return false; } else { $cartClass-&gt;resetCart(false); $cart=$cartClass-&gt;initCart(); $do=true; return true; } }") by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")      12 years 1 month ago |
| [](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#167912) | [Clear cart before a certain product is added](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#167912 "-- HikaShop version -- : current -- Joomla version -- : current 3.3 -- PHP version -- : current  hi!  I would like to create a plugin that does something when a product is added to the cart:  - It should check whether the product is part of a certain category. If this is the case, the plugin should empty the cart and then add the product to the cart, making it the only product in the cart  - If a certain product is added to the cart, it should change the shop's currency  Right now, I am working on the first part, but I do not even manage to make the cart get cleared for every product added. What I tried is this:  It clears the cart, but the product is not added afterwards. Can somebody please guide me on what I am doing wrong here? Additionally, I would greatly appreciate if you could tell me how to check if a certain product is part of a certain category.  Thank you very much &amp; all the best,  Lukas")        Category: [Development](/forum/31-development "If you are developping a plugin for Hikashop or customizing our component, this is the board to be.")     Topic started 12 years 2 months ago, by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")       [Last Post](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "just for others if you have a similar problem - I did it this way (it also changes the currency if certain products are added):  function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product&#95;id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $app=&amp;JFactory::getApplication(); $pointProducts=array(4,5,6,7); if (in&#95;array($product&#95;id,$pointProducts)) { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',1); } else { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',182); } $full = $cartClass-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $first=array&#95;shift(array&#95;values($rows)); if ($first-&gt;product&#95;id==$product&#95;id) { $do=false; return false; } else { $cartClass-&gt;resetCart(false); $cart=$cartClass-&gt;initCart(); $do=true; return true; } }") 12 years 1 month ago     by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile") | Replies:8  Views:1277 | [Last Post](/forum/31-development/870446-clear-cart-before-a-certain-product-is-added#169485 "just for others if you have a similar problem - I did it this way (it also changes the currency if certain products are added):  function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product&#95;id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $app=&amp;JFactory::getApplication(); $pointProducts=array(4,5,6,7); if (in&#95;array($product&#95;id,$pointProducts)) { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',1); } else { $app-&gt;setUserState( 'com&#95;hikashop.currency&#95;id',182); } $full = $cartClass-&gt;loadFullCart(true,true,true); $rows = $full-&gt;products; $first=array&#95;shift(array&#95;values($rows)); if ($first-&gt;product&#95;id==$product&#95;id) { $do=false; return false; } else { $cartClass-&gt;resetCart(false); $cart=$cartClass-&gt;initCart(); $do=true; return true; } }") by [erhartm](/forum/user/33354-erhartm "View erhartm's Profile")      12 years 1 month ago |

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.188 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
