Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Get 1 Free


kymation

Recommended Posts

Get 1 Free works on the product ID, so I believe you will have a problem with QTPro. Get 1 Free has a lot of coding designed to keep the number of free products consistent with the eligible paid product(s), and that's all done with the product ID. Changing it to allow multiple IDs would be a lot of work, and probably defeat some of the security features. I suggest that you look for an Addon that works on a group or category of products instead of individual products.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi.. thanks for replying so quickly.

 

OK, that's understood, but I do like your contrib a lot (bar this tweek I need ofcourse), so I cant help but want to give it a go :)

 

I was thinking, I have looked at the echo on the QTPro edited product Id... its format is Product_id { QTPro_id } Attribute_id --- eg jumper small : 29{2}2 , jumper medium 29{2}3 .. etc.

If I put an explode from the '{' on the full product Id and return the 0th from the array.. could create a product_id variable where all of the attributes under said jumper would be (for the example above) the same product id of 29 --- everything before the first { ... so that basically removes QTPros influance on your contrib regarding product ids wherever it may be needed.

 

so, something like:

 

$trueproduct_explode = explode("{",$products[$i]['id']);

$trueproducts_id = $trueproduct_explode[0];

 

Now... given the fact that your contrib works even with the QTPro alteration to the product_id leads me to believe that on the side of running your qualifying checks it already looks up the origional product_id in the PRODUCTS table, OBVIOUSLY lol, (QTPro builds its new product Id from a seperate database table).. so i dont think thats the problem... I believe the problem resides in the catalog/shoping_cart.php, where the qtpro contrib conflicts by building seperate ids and ** generating seperate products in the shopping cart page table. **

 

so, im thinking that it's looking at the quantities of one shopping cart populated product at a time, and if that 1 product has the right quantity, update quantity of free product, and maybe product id isn't actually a problem regarding qualifying for free item.

 

regarding checking quantity in cart, does checking multiple rows for matching id's sound like a simple enough modification to you?

 

If i could just get it seeing 2 items of the same id --- even though they might be seperated in the page table, i think that would do it!!!

 

I'm quite prepared to do the work to get it working and tested, I am still in training and enjoy the practice :) I think a little direction from the Dev that knows it best would help me A LOT though as I'm not 100% about how I'm going to do it :) haha

 

Your advice would be very appreciated

Thanks for your time

Martin

Link to comment
Share on other sites

Get 1 Free does most of the checking in the Cart class (includes/classes/shopping_cart.php.) That's also where QTPro converts attributes to separate products. Obviously you have to let Get 1 Free see the product ID before QTPro changes it. I haven't look ed at this in detail, so I'm not sure how feasible this is. All of the Get 1 Free changes are marked, so you can see where you need the real pID.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

OK - i give up :| haha

 

managed to get it working without QTPro's influence by manipulating arrays - got it inserting correct quantity of free products after summing all of the (exploded) product id => quantities in the cart.... so 2 jumpers, 1 medium & 1 large came up with the correct number of free products, and so on.

 

HOWEVER! haha ... problem is that it creates a free product with the correct quantity, but for each and every attributed product (of same origional qualifying product id) in the cart... so would need to be seperated from the table where the cart products are generated, to keep the free product seperate and some code to stop free product replicating everytime it sees a matching product id and so on and so on for all the qualifiers... think I'd rather put a gun to my head :/ haha, nar, I can see it taking me weeks and I dont have weeks to spare.

 

So, does not work with QTPro... took me a while but I finaly realised that now :) haha

 

Anyway, thanks for your help

Martin

Link to comment
Share on other sites

I was wondering if someone already perhaps made a catalog page to list all the products with free offers, a bit similar to the specials.php page ?

 

I find the offers are currently quite hidden, would be nice if they could stand out from the catalog pages too

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Hello again

 

regarding the update to allow it to work with QTPro attributes... I had a good look out there and nothing came even close to what I need, so I've decided (out of necessity) to go ahead and finish off the update.

 

I've set it up so that QTPro product_id doesnt interfer anymore and sums up the quantities from repeated product_ids of promotional products, so the correct quantity is now applied to the free product and it doesnt matter if you have QTPro installed or not so if you like what i've done when I'm finished, I'll post it with instructions... my serious issue is.....

 

I was wondering if you could lend me a little of your experience by advising me in the following (im reletively new(ish) to osc):

 

I want to create a check in the classes/shopping_cart that uses the $products array to see if the FREE product has already been added to the $products array, and if it has, don't add it to the $products array... once that's done, I'm anticipating nothing else would need altering... except I might seperate the free product from the main table in the cart and have them render underneith so it can be nicely styled seperately etc... from the tests I've done, altering the area where $products array gets rebuilt to include your free product details, that should mean success !!! (and $orders at the bottom in the same way, yes? or not necessary? it certainly didnt apear necessary to change during tests)

 

Right, so what's my problem then? ** bowing head in shame **

 

1) Array to be checking against to see all products currently in cart --- $this->content or $products or Niether of the above? (im possitive this is where I'm failing!!! so if you could just give me an example like attach it to a variable for me so I can test and make progress for once)

 

2) how would you go about doing a check to stop repeats being written to the array? dont need you to do it for me, just like a rough idea, even if its just confirmation (my method below) that I've got the right idea.

 

How I've been trying to do it is to use 2 nested foreach on the array to access the correct level, then do an in_array check for the free products id... bare in mind this is already being run within your IF statement that's already checked that the product ID is a free product... IF the check for Id comes back as true, don't write to Products array, else write it to Products array.. that sounds perfectly acceptable to me.. yet I've been doing it ALL DAY with no results! by the way, the IF statement would be for in_array && a check to see if it can find ['free'] => 1.... as I want to check the entire cart contents, and they might buy another of the free product aswell if they want more, so it doesnt interfer with the free product being added.

 

does all this sound good enough to you? can you see anywhere where I'm going wrong?

I've been smashing my head against a wall all day not getting anywhere with it... it works on my blank php test file with the array from print_r($products) manually added in !!! why not in osc? lol Google just isnt cutting it for this one :)

 

thanks for all your help

Martin

Link to comment
Share on other sites

Any good?

 

 

 

@@burt Yeah, looks good ! :thumbsup:

 

I was now just thinking further and wondering if this could be a content module.

It would also then allow the cash back (rebate) offers to be displayed if I setup each cash back promo leaflet as a virtual downloadable product (I think - have never tried that.

Edited by bruyndoncx

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

I'm not convinced that this is a good idea. The free product carries through to the Orders class, as it must to register in the order database. Separating it out may cause more trouble than it's worth.

 

You're asking a lot of detailed questions about something I wrote years ago. Sorry, but my memory is not that good. I need to go back and look at the code again. I'm busy right now, but maybe later.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

A million thanks.. I really need this, so it needs to be a good idea!

 

I am 95% sure that im failing in not calling the array properly, because the code that uses it is perfectly fine, and I get the occasional errors: such a thing was expecting an array etc.

 

it's not affecting anything that doesnt have QTPro installed, you already have the free product singular to the promotional product id anyway... by including this check for repeats before re-adding again, it creates the correct products array that everything else gets it's information from... dont worry, I'll be having the headache over that :) I just cant figure out how I'm supposed to be calling the products array properly because it's just not pulling through to my code as it does on blank php file with the EXACT array added manually.

 

Actually, I might open up another post, take some stress off you digging blind just going off my explainations. If you do find anything, that's great.. I'll see if anyone else out there has some recent experience with this

 

Anyway.. thanks so much for your help

 

Martin

Link to comment
Share on other sites

Hey Jim

 

Nevermind looking for a solution.. I've found one :) I was trying to do literally the impossible before, could have kicked myself when I noticed.

 

be sure I'll keep you updated when it finaly works with QTPro

Link to comment
Share on other sites

  • 1 year later...

Hi, Jim:

 

I'm interested in installing an add-on that will allow me to offer a free embroidery design when the customer purchases x number of designs. Sometimes I will want to select the design to be given (such as "Buy 3 designs get the Christmas Joy design free")... and other times I will want to allow the customer to select the design that they would like as their freebie ... (such as "Buy three designs and get a free design of your choice".

 

Does your Get 1 Free add-on do that?

If so, will it work well with osC 2.3.3.4?

 

I see that there have been updates to this add-on since yours. Would you suggest that I install the latest version? Or do you suggest that I install yours?

 

Thank you,

Jewell

Link to comment
Share on other sites

No, this one is a simple "buy X of one item and get Y of the same item for free." I seem to remember a rewards addon that worked with a quantity of different items, but I don't remember the name right now. Maybe someone else has a better memory.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 1 month later...

hi all I just have installed the module GET 1 FREE in OSC 2.3 and it works great but i have just one question.

 

Is there a possibility that we give a free product with every order.

So buy one and get one free product.

We now gift a free LED light with every order see: www.vinyl-masterpiece.com.

Hope to hear from you soon :thumbsup:

Link to comment
Share on other sites

That's really hard to read. Please don't do that.

 

This addon is designed to give one extra product of the same type as the one(s) ordered. There is probably another addon that can be used to do what you want, but I don't remember the name. You can search the addons area, or post in the general forum if that doesn't turn up anything.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 3 months later...

Hello Jim,

 

First of all i thank you for this Addon. :)

 

My Requirement is Bit Different ,

 

Requirement Is ; "Buy 2 items from manufacturer ABC, get a 3rd one free" (If Customer Added the 2 products From manufacturers ABC then the 3rd product (that have a least product price) will be free (3rd product Price Will be 0)).

 

Is there any Addon Available to achive this?

 

Any help would me Much Appriciated.

 

Thanks!!

Link to comment
Share on other sites

I'm not aware of anything that does what you want. Have you searched the Addons? You might need to modify something or write new code to do this.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hello Jim,

 

First of all i thank you for this Addon. :)

 

My Requirement is Bit Different ,

 

Requirement Is ; "Buy 2 items from manufacturer ABC, get a 3rd one free" (If Customer Added the 2 products From manufacturers ABC then the 3rd product (that have a least product price) will be free (3rd product Price Will be 0)).

 

Is there any Addon Available to achive this?

 

Any help would me Much Appriciated.

 

Thanks!!

I think ThatSoftwareGuy http://addons.oscommerce.com/profile/145221

has a solution for this. I'm not sure if it is supported in the quantity discount free add-on, for sure it is something he has programmed. I used a paid module for a manufacturers based promo (2nd half price)

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Hello Carine,

 

Can you Please do Let me know which Paid Addon you have used?

 

I dont think thatSoftwareGuy will fulfill my requirements..

 

Thanks!!

I have used Better Together and Big Chooser (paid).

I had some extra requirements as my selection of products was limited to a subset of the manufacturers products, so I extended the code with an ART_TO_MAN case.

That is what I remember, I think your situation is supported by default.

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...