News:

Looking for documentation? Take a look on our wiki

Main Menu

Searching in store invalidates any custom code written?

Started by mailblade, February 17, 2018, 09:09:47 AM

Previous topic - Next topic

mailblade

My products are listed in table format. In the last column of the table, is the "Addtocart" class.

Now, depending on certain values for the products, there is some code which will determine whether the "Addtocart-button" should be disabled or not, for the specific item. (It checks if the $cartItem['quantity'] is == the $max_balance for the current product. $max_balance is a custom variable I created)

Now, it's not a lot of code, just a simple "if" statement.

When the balance for the product in the cart is the SAME as the one defined in the category page listing, the addtocart-button is disabled. Meaning they can't order anymore. (I have multiple stores and each one has a product balance, not all the same)

HOWEVER, when I search for the product SKU, then enter max allowed "balance" into the cart (not stock quantity, $max_balance is custom defined value) and reload the page, it's not disabling the button.

Simple explanation:

1.Two stores and two products
2. Stock Quantity for both stores is 50
3. Store 1 has 30 as "$max_balance" (customfield), Store 2 has 20 as $max_balance
4. If you are in user group Store 1, you can not order more than 30 of the product. It alerts when you try and order 31, and if you order 30 on the dot it checks the $cartItem['quantity'] and checks the $max_balance, it then determines if you can order more. (it's working)
5. When I search for an item, these features disappear. Almost as if the code disappears. I think it's because there's a different URL when you search.

Is there any way I can edit the search module?

Studio 42

You request need a core hack, override system plugin to use own class or you have to develop a customfield plugin, if you have only some product that use this values
Free XML sitemap generator [url="http://shop.st42.fr/en/catalog/products/virtuemart-2-sitemap.htm"]http://shop.st42.fr/en/catalog/products/virtuemart-2-sitemap.htm[/url]  , Free Unused Image cleaner [url="http://shop.st42.fr/en/products/virtuemart-media-folder-clear.htm"]http://shop.st42.fr/en/products/virtuemart-media-folder-clear.htm[/url]
Language Switch in product & category [url="http://shop.st42.fr/en/categories-tools/multi-language-for-virtuemart.htm"]http://shop.st42.fr/en/categories-tools/multi-language-for-virtuemart.htm[/url]
More extentions [url="http://shop.st42.fr/en/"]http://shop.st42.fr/en/[/url]