Jump to content

Is this product selection / adding to cart possible


clivemajor

Recommended Posts

Hi Guys,

 

I've got a job on at the moment that needs a system like the site linked below.

 

There is a table the has a 'quantity' column at the end of row.

 

E.g. if you wanted X amount of item '1481a' and X amount of item '1481' and can enter that in the 'quantity' box at the end of the row. Then when you've finished filling in needed products you click 'Buy' and the 'Shopping Backet' in the top right corner updates with selected products.

 

Have a test and you'll see what I mean.

 

http://www.ukpackaging.com/general-packaging/adhesive-tapes/vibac-adhesive-tapes/vibac-425-hot-melt-tape/

 

 

Is this possible using Prestashop?

 

Many thanks for your help in advance

 

Best wishes

 

Clive

Link to comment
Share on other sites

  • 2 weeks later...

Most things are possible, it is just a matter of how much time and effort you want to put into it.

 

=)

 

With the stock Prestashop, that type of product grid is not provided. However, you could implement one either by modifying the product-list.tpl template to change how the products are listed or via a custom module that can be called directly if you a special case use.

 

Essentially what you have to do is change the product list layout to include the quantity field and then add a new global submit trigger (button, image, etc.) that calls a custom Javascript function that cycles through an array of product IDs and triggers the normal "add to cart" Javascript action with the qty for each associated product row / form.

 

In product-list.tpl there is section:

 

<a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>

 

Externally when the document is loaded, a Javascript "add to cart" function is tied to the onclick event of the above. So what you need to do is call the same function but add the quantity to call which you can pull from your custom quantity field. There is a chance that quantity is not exposed at this level but as the underlaying AJAX call in the cart Javascript supports quantity worst case you may have to write your own function based on the stock one.

 

So it should be doable, just hard to say how long it would take without doing the work.

 

On downside would be that the more products you add, the slower the process will be unless either there is a mass add to cart AJAX call available or you are willing to write your own server side glue to do this.

 

Cheers

Edited by codegrunt (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...