Jump to content

Custom combinations price vs GetPriceStatic


Recommended Posts

Hi lads, 

I'm a middle of a project with a new challage to sort out as soon as possible and I hope to get some good suggestions by you. 

I have only 4 products to manage but those products have dimensional attributes (width, length, height) that are going generate a lot of combinations each of them having a specific price ( about 4 millions of different combinations ). 

Due to the number of generated combinations was to hight also to simply search a product, I created a module to manage "base" of combinations and internal rules to calculate correctly the price for each of them. Then I created a new search form included in the category view where to find the products including their price matching the applied filters in the form..

Finally my problem, I want to add my specific combination into the basket and purchase it :-). 

 

The solution I'm applying is: 

- adding a new query string parameter for my combination 

- "ovverride" the getpricestatic method to retrieve my combination to return the correct price 

- Looking in all modules I need to apply the same workaround on the point above (adding query string parameter, retrieve my combination parameter, set correctly the properties I have to)

I'm just wondering if there are other solutions I did not considered before than can help me to cover my needs. 

 

I'm using ps 1.7.3.0 

 

Thanks a lot, 

Gus

 

 

 

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

  • 1 month later...

You want add to cart directly from ajax search? You think on instant search than ajax, right?  Hope you can get some tips, but i think can find a module (on addons) to achieve this.. of course, if you already done those functionalities on your modified search, you will be able to finish it.. good luck dude

The fast way i can think on, is change how click on items finded works.. at .js  i can see, and convert it to a add to cart button directly..

document.location.href = data.product_link;

Hope this can give you some ideas..

 

On other side, im lookig to do something similar, without add to cart at the moment.. 

im trying to get price on search adding this on search.php around line 185

p.price pprice,

like..

        if ($ajax) {
            $sql = 'SELECT DISTINCT p.id_product, pl.name pname, cl.name cname, p.price pprice,

then changed .js related to blocksearch on parse function.. and similar to images.. other tutorials around explain more..

{ data: data[i], value: data[i].cname + ' > ' + data[i].pname + ' > ' + data[i].pprice }

At this point, im able to get prices on cart.. but having problems with combinations.. showing 0 as price base.. (like i have on backoffice) but didnt get the default combination for show the price like in product-list or somewhere else..

I think in the same way to apply "pa.product_attribute" on $sql SELECT, but no result.. hope you can help me on this..

There are few functions to get prices on shop, but i didnt know how to make it work on search.. displayWtPrice , getPriceStatic, and others.. but no lucky...

Please some help.. 

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...