VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: Khaostar on March 24, 2014, 18:27:34 PM

Title: Need help on simple search plugin
Post by: Khaostar on March 24, 2014, 18:27:34 PM
Hi everyone!

I'm actually developping a site with Virtuemart 2. I'm creating a little "plugin" to search by multiple fields. In fact, I have a simple ajax / php query that I want to use. With this little search page, I can easily have the product ID that fits my search. But I'm stuck with it.

Simple explanation : I have an array of product ID. Now I want virtuemart to show all of these products. Is there any easy way to do that? a custom URL maybe?

I'm new to Virtuemart, a little help would be appreciated! :)
Title: Re: Need help on simple search plugin
Post by: ITechnoDev on March 25, 2014, 22:26:13 PM
QuoteI have an array of product ID. Now I want virtuemart to show all of these products

There is a method named "getProducts" that returns products for given array of ids :

getProducts (   $productIds,
  $front = TRUE,
  $withCalc = TRUE,
  $onlyPublished = TRUE,
  $single = FALSE
)
   

For more information please check this documentation :

http://docs.virtuemart.net/api-vm2/dd/d5a/class_virtue_mart_model_product.html#aa69962a06ea1ebcd425e52290d57ca69
Title: Re: Need help on simple search plugin
Post by: Khaostar on March 26, 2014, 22:19:31 PM
Thanks for the reply!

I found a solution by myself yesterday. I changed a bit my method and instead of sending the IDs of the products, i'm sending a custom query to the com_virtumart / category. That's perfect for my need. :)

thanks anyway!