bykrmom Posted September 2, 2009 Share Posted September 2, 2009 I need some collaboration on this project. It's not a huge thing, but it's going to be very usefull when it's done.I am using and making modificattions to PS ver. 1.1.0.5 (Ver. 1 Final).I want to use the add to cart (add_to_cart) function to add a "sample" to the cart. I've created the display box for the front office. Because most of prestashop's code is still mostly a mystery to me, I need some coding help or a few strings of code.The size/amount of the sample is unimportant, as it changes with the particular product anyway. What I want is for the add_to_cart function to put the product in the cart at FREE or $0.00 (dollars for my side of the pond) if it's a sample. I want to add a prefix of "Sample" or "Samp" to the listing in the cart, and to the eventual order invoice and subsequent email confirmation and shop email notifications.I know I'm probably not the only one who'd like to see a samples function.(Because I've altered my Prestashop so much over the past year+, I won't be able to upgrade it until I get it on an SVN server... so I'm writing these "sample" changes for this version.) Link to comment Share on other sites More sharing options...
bykrmom Posted September 4, 2009 Author Share Posted September 4, 2009 Alright - here's where I am so far: I have the show-noshow function for 'samples available' working in the front and back office. You check a box that says there are samples, you get the samples available box on the product page. I have created the database column, the on/off function, and even cleaned it up in the back office so it looks like it came with PS.Now I need help with the functions in the shopping cart area.Currently when I click my "Send me a Sample" button, I get it to go into the cart, but it still puts it in as a regular product ie: case, description, and price. What I really need is help locating the part of the add_to_cart functionality that actually gets and reports the price when the product is added and displays in the cart itself.Once I have that done, the changes will work and it looks great, like a regular part of PrestaShop and not a hack. Link to comment Share on other sites More sharing options...
bykrmom Posted September 4, 2009 Author Share Posted September 4, 2009 Somebody has to know where I should look in the code for the parts I need to alter/add to/rewrite to make this work. Please help me with some direction for what file to look in, maybe if you know, pinpoint the code? I NEED this to work soon.Where in Prestashop does the Add to cart button get the command to put the price in the cart?Do I need to register a 'function' in init.php to have the shop recognize what a sample is?Do I need to define a sample in JSON?Can this be done simply by (copying and then) altering the add_to_cart code in ajax-cart.js?I'm swinging in the wind here.... :-S Link to comment Share on other sites More sharing options...
zigon Posted September 11, 2009 Share Posted September 11, 2009 the code to add somthing to the cart is $result = $cart->updateQty(intval($qty), intval($idProduct));you can see this function in more details in the classes/Cart.phpI suspect you may wish to change the cart.php in the home folder (as well as the ajax to check for your sample products and add them at £0, or you could alter the product.php in the home folder to add a buy now button for a sample which passes though the product to the cart.php at no cost.Hope that helps Link to comment Share on other sites More sharing options...
bykrmom Posted September 14, 2009 Author Share Posted September 14, 2009 Thank you, zigon!I am now working with a programmer to create a stand alone module to accomplish this sample function, and what you have sent me will help very much. I will let you know how it turns out. Angie Link to comment Share on other sites More sharing options...
Radu Posted December 12, 2010 Share Posted December 12, 2010 have someone used this module - it's very cheap and it seems a very good starting pointhttp://www.eliteeffex.com/products/prestashop/blocksample/order.php Link to comment Share on other sites More sharing options...
brik Posted December 2, 2012 Share Posted December 2, 2012 Has any got the BlockSample from www.eliteeffex.com. I'm finding it difficult to have the Sample button go anywhere. Anybody anyideas please? Link to comment Share on other sites More sharing options...
Recommended Posts