Custom Product Selection

  • Posts: 63
  • Thank you received: 1
9 years 1 week ago #249231

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 4.5
-- PHP version -- : 5.6
-- Browser(s) name and version -- : Chrome

Hi,

I'm trying to develop a custom product builder by selecting a product and filtering the next listing based on the first selected product. Here's the sample page c13117.sgvps.net/~enigma/index.php?optio...cle&id=45&Itemid=267

Instead of having an add to cart, I want to have a add to list, save the id and the custom fields to compare on the next listing.
Or maybe use a "multi cart" option, is there you have any suggestion to accomplish it?

Any help will be highly appreciated!

Regards,
Gary Yumul

Please Log in or Create an account to join the conversation.

  • Posts: 84313
  • Thank you received: 13702
  • MODERATOR
9 years 1 week ago #249250

Hi,

In your case I would do it like that:
Have each list of products in a different category.
Create one HikaShop content module for each category.
Configure your choose buttons to open a popup with the corresponding HikaShop content module.
Use the normal add to cart system on the products.
Create a small plugin of the group "hikashop" and implement the onBeforeProductListingLoad trigger:
www.hikashop.com/support/documentation/6...reProductListingLoad
That way, you can add your filters on the content module listings with that plugin based on what you have in the cart.
Thanks to doing it like that, the development necessary will be reduced to the bare minimum with only a few lines of code in the plugin to load the cart, and apply the filter on the products listing loading query based on what you need.

Please Log in or Create an account to join the conversation.

  • Posts: 63
  • Thank you received: 1
9 years 1 week ago #249310

Hi

Thank you for the reply, How about adding to a list just to a wishlist and will add to cart once the client finished selecting products? is that possible?

A filter would be based on custom fields from a previously selected product category. (ex. Form Factor, Socket Type etc..)

On using onBeforeProductListingLoad and creating a plug in, what kind of plug in should I create? sorry for asking this.

Thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 63
  • Thank you received: 1
9 years 1 week ago #249313

Or maybe we could have the multi cart option; one for the custom build and the other for the other products.

is this possible?

Thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 84313
  • Thank you received: 13702
  • MODERATOR
9 years 1 week ago #249321

Hi,

1. I don't recommend using wishlists. In that case, yes, simply use several carts. You can change the current cart with such code:
$app = Jfactory::getApplication();
$app->setUserState('com_hikashop.cart_id',$cart_id);

2. I'm talking about a standard Joomla plugin, of the group "hikashop".
www.hikashop.com/support/documentation/6...mentation.html#howto

Please Log in or Create an account to join the conversation.

  • Posts: 63
  • Thank you received: 1
9 years 1 week ago #249376

Here's what I have now, I loaded the listing thru iframe, and add filter modules on each pages. Can you help me on how to add a function onto the Add to Cart button, to get the custom value field assign on the selected product and assign the value on the filter module?
c13117.sgvps.net/~enigma/index.php?optio...cle&id=45&Itemid=267


Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 84313
  • Thank you received: 13702
  • MODERATOR
9 years 1 week ago #249382

Hi,

You want to edit the file "filter" of the view "product" via the menu Display>Views.
There, you need to load the products from the cart:

If you want to load the current cart data, you can use the code :
$cartClass = hikashop_get('class.cart');
$cart = $cartClass->loadFullCart();
The products in the cart will be available in the attribute as an array of product objects:
$cart->products

www.hikashop.com/support/documentation/6...umentation.html#code
And there, you can set the values in the $_POST array using the name of the inputs, for example: filter_MemorySlotNumber_14

Please Log in or Create an account to join the conversation.

  • Posts: 63
  • Thank you received: 1
9 years 6 days ago #249565

Hi

Thanks for the help, now Im still working on this, is there anyway that I can access the category name of a product on product object?

Here's my code;

<?php 
 $cartClass = hikashop_get('class.cart');
 $cart = $cartClass->loadFullCart();
 //The products in the cart will be available in the attribute as an array of product objects:
 $vProducts = $cart->products;
 foreach ($vProducts as $key => $value) {
   # code...   
   echo '1) Product ID: '.$value->product_id.'\n';
   echo '1) Product Name: '.$value->product_name.'\n';
   echo '1) Categories: \n';
   var_dump($value->categories);
   $productClass = hikashop_get('class.product');
   $product=$productClass->get($product_id);
   echo '2) Product ID: '.$product->product_id.'\n';
   echo '2) Product Name: '.$product->product_name.'\n';
   echo '2) Categories: \n';
   var_dump($product->categories);
  }
?>
Im getting null on this $product->categories

Here's the documentation I have checked. Any help?

Thanks

Last edit: 9 years 6 days ago by Jerome. Reason: [code] is nice

Please Log in or Create an account to join the conversation.

  • Posts: 84313
  • Thank you received: 13702
  • MODERATOR
9 years 6 days ago #249603

Hi,

You have to load them yourself:

$productClass = hikashop_get('class.product');
$product->categories=$productClass->getCategories($value->product_id);

The following user(s) said Thank You: Yumul

Please Log in or Create an account to join the conversation.

Time to create page: 0.074 seconds
Powered by Kunena Forum