Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Get 1 Free


kymation

Recommended Posts

I just installed the newest version and I'm getting this error

Parse error: syntax error, unexpected T_CASE in /home/***/public_html/includes/application_top.php on line 360

 

is there anything wrong with the below code? i'm clueless and my sites down so panic time xD

 

// Start get 1 free

if ($HTTP_POST_VARS['free'][$i] != 1) {

$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);

}

// End get 1 free

 

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

// customer adds a product from the products page

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

Link to comment
Share on other sites

That code looks entirely correct. Did you accidentally delete the } on the line just above that? If not, you'll need to check your mods -- that error is probably due to a mismatched {} somewhere above the lines you showed.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi,

 

I downloaded the pack get_1_free_1.4.2

plz see missing file..

==========

New Files:

==========

 

The following code files are new with this package:

 

catalog/admin/get_1_free.php

catalog/admin/includes/languages/english/get_1_free.php

catalog/admin/includes/functions/get_1_free.php <<<------------- this is missing in the pack.

catalog/includes/functions/get_1_free.php

Link to comment
Share on other sites

Hi,

 

I downloaded the pack get_1_free_1.4.2

plz see missing file..

==========

New Files:

==========

 

The following code files are new with this package:

 

catalog/admin/get_1_free.php

catalog/admin/includes/languages/english/get_1_free.php

catalog/admin/includes/functions/get_1_free.php <<<------------- this is missing in the pack.

catalog/includes/functions/get_1_free.php

See this post

 

Regards

Jim

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

Link to comment
Share on other sites

Check your Admin setup. The end date being set wrong is a common error. If all that is set correctly, check your mods, particularly in the Shopping Cart class. I can't get any more specific than that; there are too many ways to cause the free product to not show up.

 

Regards

Jim

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

Link to comment
Share on other sites

okay i checked shopping_cart class i missed its edits, :D

 

Now working perfectly :)

 

--

 

Is it possible to add multiply free product with one product ?

 

Like --> buy one computer get pendrive, mouse, headphone FREE

Edited by vinod41
Link to comment
Share on other sites

I hadn't thought of multiple free products for one order, so that would be a bit of a hack. You could add a "product" containing all of those as a set, then assign that as your free product. Other than that, it would take some code changes to actually select multiple products.

 

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

Hello - I use Paypal IPN and I was wondering if anyone else has tried to install this ?

 

IPN does away with checkout_process.php file so I'm unclear about what to do with the mod for that file as the code mentioned in install does not exist in IP (only in checkout_process.php)

 

This is the nearest code I could find in the paypal IPN file:

 

// Let's get all the info together for the email
$total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
$total_cost += $total_products_price;

// Let's get the attributes
 $products_ordered_attributes = '';
  if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
		for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
		   $products_ordered_attributes .= "\n\t" . $order->products[$i]['attributes'][$j]['option'] . ' ' . $order->products[$i]['attributes'][$j]['value'];
		 }
  } 

// Let's format the products model	   
$products_model = '';	  
  if ( !empty($order->products[$i]['model']) ) {
	  $products_model = ' (' . $order->products[$i]['model'] . ')';
	  } 

// Let's put all the product info together into a string
  $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";


}		// PRODUCT LOOP ENDS HERE

 

Does anyone have an example of the code they have used in their IPN file?

 

Thanks

Sol

Edited by ssnb
Link to comment
Share on other sites

I've never used Paypal IPN, so this is going to be a bit vague. The only thing that this contribution adds to checkout_process.php is a bit of code to store any free products to the orders_products table, so that they show up when viewing the order in the admin. I believe that Paypal IPN has a page that it returns to after the payment is complete. This is the page that sends the confirmation email to the customer and saves all the data to the database. That's where you need to paste this chunk of code. The code should look similar to that in checkout_process.php, at least as far as the database and email functions go, so this shouldn't be too dificult to find.

 

Please let me know if you get this figured out, so I can add something to the instructions. Or do it yourself if you wish.

 

Regards

Jim

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

Link to comment
Share on other sites

I've never used Paypal IPN, so this is going to be a bit vague. The only thing that this contribution adds to checkout_process.php is a bit of code to store any free products to the orders_products table, so that they show up when viewing the order in the admin. I believe that Paypal IPN has a page that it returns to after the payment is complete. This is the page that sends the confirmation email to the customer and saves all the data to the database. That's where you need to paste this chunk of code. The code should look similar to that in checkout_process.php, at least as far as the database and email functions go, so this shouldn't be too dificult to find.

 

Please let me know if you get this figured out, so I can add something to the instructions. Or do it yourself if you wish.

 

Regards

Jim

 

Thanks for your fast reply Jim - I will give it a go and let you know.

 

Also, I use discount coupon codes and points and rewards. Do you know if there is any conflict?

Cheers

Sol

Link to comment
Share on other sites

There are no conflicts with the coupon contribution that I use, althoough that is an older version. There shouldn't be a problem with any of those, so long as you put the changes in the right places.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 3 weeks later...
There are no conflicts with the coupon contribution that I use, althoough that is an older version. There shouldn't be a problem with any of those, so long as you put the changes in the right places.

 

Regards

Jim

 

 

Hi Jim and readers

 

I installed this great contribution and it worked flawlessly - except for the dodgy instruction that took a bit of fiddling - lol

 

Is there any way to set up the buy 1 of any category item and get 1 free?

We are a clothing store and have hundreds of items. I need to offer a free tee with any purchase over $50 - or e.g. any pair of jeans. It would take a long time to apply the get 1 free to all the individual products!

 

Any ideas?

 

Thanks

Sol

Link to comment
Share on other sites

I have found a bug ! :-(

 

I notice that it works fine with only 1 item and fine with Points and Rewards, and with the discount coupon code contributions.

 

However, I am offering a free tee with any jeans bought - so if you buy two jeans, you get 2 free tees.... this seems to be fine until you enter a discount coupon code, then the calculation is incorrect on the checkout_confirmation page ... anyone else experienced this and (hopefully) have a fix for that?

 

Cheers

SSNB

Link to comment
Share on other sites

I have found a bug ! :-(

 

 

OK I think i've identified that it is the discount code that is causing the conflict.

 

If you buy the 1 full priced item, you get the free one no problem. This seems to work fine no matter how many full priced items you buy (you still get the free items correctly).

 

However, when at the checkout, if you enter a discount coupon code, the order total is corrupt ! So in other words, this doesn't seem to sit well with discount coupons.... and I'm guessing the discount coupons code needs to be told to ignore the free items?

 

I will post this message in the discount coupon codes forum too and hope someone can help as it would be a pity to have to remove this contribution

Cheers

SSNB

Link to comment
Share on other sites

I haven't seen this problem before, but it sounds like the discount contribution is modifying something that this contribution depends on, or the other way around. The trick is in finding the conflict.

 

This contribution was designed to offer an incentive to buy individual products, not an entire category or an entire store. You would need to apply it to each product individually. Perhaps there is another contribution that would work better for you. I seem to remember finding a couple of other free product contributions when I was originally trying to solve this problem, but I don't remember details.

 

If you find somethig in the instructions that isn't correct, or any other bug for that matter, please let me know what it is so I can fix it. Or fix it yourself and post it if you want. If you find what's causing the problem with that other contribution, I'd like to know that too.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi Jim

 

I have found a temporary solution for now: exclude the get 1 free product from the discount offer. It solves the problem, except anyone buying the get 1 free product on its own (and paying the RRP) wouldn't be able to get any discount. Not a problem for individual products but when there are multiple choice I guess it gets more complex.

 

From this random fix that i tried and found it worked, I can only assume that it is the discount coupon code contribution that is at fault. I assume that somehow, I need to tell the discount coupon code to ignore any product that has a zero against it - I imagine that's where the issue is!

 

Will keep you posted!

Thanks

Link to comment
Share on other sites

little question about this contribution.

Can the free product be an item that is inactive? for example if I want to give them a token gift that I do not sell (a promo item) will this contribution work for that? Or is there something else?

Thanks,

Susan

 

 

Proudly uses Oscommerce!

Link to comment
Share on other sites

purplemartinart: Yes, you can put your free products in a hidden directory. You'll need to install a contribution that allows hidden directories to do that.

 

crombiecrunch: No, this one cannot do percentage off, just free product(s).

 

Regards

Jim

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

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

A small issue calendar doest work i get this error

 

Error: document.getElementById("" + id + "") is null

Source File: http://www.stay-in-newzealand.co.nz/admin/...calendarcode.js

Line: 161

 

Error: return not in function

Source File: java script:calClick();return%20false;

Line: 1, Column: 11

Source Code:

calClick();return false;

 

Any idea how to fix it ?

 

Thanks

Steve

Link to comment
Share on other sites

Anyone know of any way for there to be a picture of the "Free item" AND the product name?? As of now, its just the product name. It would look really cool IMO if there was also an image of the freebie for customers to associate with it....

 

Any ideas or has anyone done this??

 

Thanks in advance

 

Mike

Link to comment
Share on other sites

steve: It works for me, so it must be something in your installation. Check that your file is not corrupted, or try uploading again. Otherwise I have no idea why it wouldn't work.

 

Mike: It would be possible, but you'd have to modify that SQL to pull the image name from the Products table. Then it's a simple matter to display it.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi,

 

A small issue calendar doest work i get this error

 

Error: document.getElementById("" + id + "") is null

Source File: http://www.stay-in-newzealand.co.nz/admin/...calendarcode.js

Line: 161

 

Error: return not in function

Source File: java script:calClick();return%20false;

Line: 1, Column: 11

Source Code:

calClick();return false;

 

Any idea how to fix it ?

 

Thanks

Steve

 

Ok if anyone else has this issue

change

<td class="main"><?php echo tep_draw_input_field('day', (isset($fInfo->expires_date) ? substr($fInfo->expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($fInfo->expires_date) ? substr($fInfo->expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($fInfo->expires_date) ? substr($fInfo->expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();return false;" onmouseover="calSwapImg('BTN_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_get_1_free','dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a></td>

 

to

<td class="main"><?php echo tep_draw_input_field('day', (isset($fInfo->expires_date) ? substr($fInfo->expires_date, 8, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('month', (isset($fInfo->expires_date) ? substr($fInfo->expires_date, 5, 2) : ''), 'size="2" maxlength="2" class="cal-TextBox"') . tep_draw_input_field('year', (isset($fInfo->expires_date) ? substr($fInfo->expires_date, 0, 4) : ''), 'size="4" maxlength="4" class="cal-TextBox"'); ?><a class="so-BtnLink" href="java script:calClick();" onmouseover="calSwapImg('BTN_date', 'img_Date_OVER',true);" onmouseout="calSwapImg('BTN_date', 'img_Date_UP',true);" onclick="calSwapImg('BTN_date', 'img_Date_DOWN');showCalendar('new_get_1_free','dteWhen','BTN_date');return false;"><?php echo tep_image(DIR_WS_IMAGES . 'cal_date_up.gif', 'Calendar', '22', '17', 'align="absmiddle" name="BTN_date"'); ?></a></td>

 

All i did was remove the "return; false" from the section below hope this helps anyone else

href="java script:calClick();return false;

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