Jump to content
Sign in to follow this  
ugottasalsa

[contribution] "osC_GiftWrap_v1.0"

Recommended Posts

Updated version available!

 

I have just posted a well needed update to Giftwrap, most notably:

 

1) Overcome the issue of the VAT/sales tax not being calculated in the total VAT/sales tax for the order in the checkout_confirmation screen.

2) Fixed the sort order problem

3) Fixed the conflict between shipping and giftwrap in the checkout_shipping page.

 

It would be nice to see someone find a way to include a text box, whereby the customer can write a short note which can be attached to the package. I have not got round to this, but it would make this contribution more complete.

Share this post


Link to post
Share on other sites

Is there a possibility to add the giftwrap charge in percents??

 

I think its a pretty difference if a customer buys one small gift, or twenty big gifts. If he buys 20 big gifts, the giftwrap charge should increase, so it would be great if this contribution supports pecentage costs.

 

I want to sell Light Emission Diodes (LEDs), and with this contrib I will offer: Buy with or w/o resistors, so I use a percentage charge... B)

 

Regards,

lucas

Share this post


Link to post
Share on other sites

Great mod and i have been using it for a couple of months now without any issues. Definetely looking forward to some of the improvements scheduled for the next release. One quick question I have is as follows:

 

Does anyone know how to change the admin text colour for this module. I have a real problem where it is extremely easy to miss the fact that a customer has requested an item to be gift wrapped. If when they requested gift wrapping it showed up on their order as bolded red etc. it would be much easier to notice. Can anyone help???


Scott Lawry

Share this post


Link to post
Share on other sites

After hitting continue on checkout_shipping.php I get this error:

 

Fatal error: Cannot use object of type __PHP_Incomplete_Class as array in /home/crust/public_html/includes/classes/gift.php on line 25

 

Can anyone help?

Jacob

Share this post


Link to post
Share on other sites

I have the same problem

 

hello, i am having a little problem with the giftwrap contribution:

 

when a customer enters the checkout_shipping page he can select between "giftwrap" and "no giftwrap". "giftwrap" is selected by default, but i want "no giftwrap" to be the default value. i already tried to change the sort order of these two options in admin -> modules -> giftwrap, but "giftwrap" still appears on top and is selected by default. why can't i sort these options?

Share this post


Link to post
Share on other sites

my main problems with this otherwise great contribution are:

 

gift text box --- it's written into the code, but for whatever reason doesn't work, if gift wrap is selected the customer should be able to enter a gift message.

 

defaults to 'gift wrap' selected instead of 'no gift wrap'

 

if anybody has work arounds for these, please post :)

Share this post


Link to post
Share on other sites

I am about to install this contrib. and I wanted to ask you if you think its a good contrib to install?


at the end of the day the code will be good

Share this post


Link to post
Share on other sites

I just finish instaling the contrib.

 

and I was wandering if there is a way to check one of the options by default ?


at the end of the day the code will be good

Share this post


Link to post
Share on other sites

I am getting the below error using GiftWrap v1.1 if anyone can help:

 

Parse error: parse error, unexpected $ in /var/www/html/shop/checkout_shipping.php on line 638

 

Thanks!

Share this post


Link to post
Share on other sites

In your catalog/checkout_shipping; look for this code.

 

// one button is not an array
if (document.checkout_address.giftwrap[0]) {
  document.checkout_address.giftwrap[buttonSelect].checked=true;
} else {
  document.checkout_address.giftwrap.checked=true;

 

replace it with

// one button is not an array
if (document.checkout_address.giftwrap[0]) {
  document.checkout_address.giftwrap[buttonSelect].checked=true;
} else {
  document.checkout_address.giftwrap.checked=false;

 

Has anybody found a solution for the sorting problem with the Gift Wrap Modification????? Any help would be great!!!!!

Share this post


Link to post
Share on other sites
===============================================

osC_GiftWrap Module v1.0

===============================================

OVERVIEW

There has always been a lack of solutions available for offering a GiftWrap Option for your customers orders. I found a few suggestions in the osC Forums, but they are more like "work-arounds", not the "REAL THING".

So, I decided to write one! I spent alot of time getting this to function correctly. It wasn't easy. Anyone that is familiar with the osCommerce checkout process knows what I mean.

If you find any bugs or errors, please email me.

I must say this, though... I was VERY disappointed when I posted messages here the osCommerce Forum asking for a bit of help when I got stuck... and absolutely NO ONE from the Community offered any assistance what-so-ever! :( So this is all me.

We should all be working together in the single goal of advancing this great product!

===============================================

WHAT WILL IT DO?

This GiftWrap Module Addon will provide the option of adding GiftWrap to the Order during the Checkout Process.

<- osCAdmin ->

This Addon contains...

1 new Order Total Module - ot_giftwrap.php

2 new GiftWrap Modules - giftwrap.php and nogiftwrap.php

1 new Class file - Gift.php

All of which are controlled via osCAdmin under Modules. You will see that a new GiftWrap Option will appear in osCAdmin under Modules and a new GiftWrap selection in Modules -> Order Totals. Each of these new Modules needs to be activated to work correctly! Make sure you adjust your Order Total Sort Options to display your Order Total options in the right order.

<- Checkout ->

A new box is created on the Checkout Shipping Page asking... "Would like to GiftWrap your Order?" There are two options, GiftWrap or No GiftWrap. Each with an associated cost configured in osCAdmin. The GiftWrap amount is applied to the Order and appears on the Checkout Confirmation Page, both in the Shipping Summary and in the Order Totals.

This same information will be included on the Customers Order Invoice and Packing Slip.

===============================================

REMARKS

Please remember that this is osC_GiftWrap Module v1.0!

I am presently working on a future release with more features, such as...

-> checkbox selection instead of the radio buttons.

-> Add a "GiftCard" Message - A Personalized Message or Greeting to the Recipient

-> Free GiftWrap with Purchase Amount

-> Choice of Wrapping Paper

If you have any suggestions to make this osC GiftWrap Module better, let me know... I am VERY open to suggestions. Please eMail me.

===============================================

 

I just wanted to show you some love coming up with this option for future newbies like me! I appreciate you! :thumbsup:

Share this post


Link to post
Share on other sites

Just to start, a great contribution and not too difficult for me to install knowing little PHP, it was just a hunt n peck kind of thing, not too bad... I've got to try the sort order change thing in the couple posts before this reply if it is indeed meant to make 'no gift wrap' the top option...

 

but my problem is a little higher in the confirmation page;

 

Delivery Address (Edit)

Elizabeth Collins

14 X St

City, TX 7960X

United States

 

Shipping Method (Edit)

Flat Rate (Best Way)

HEADING_GIFTWRAP_METHOD

(Gift Wrap)

 

I think it should be showing up as Gift Wrap Method no as it is showing with the HEADING_GIFTWRAP_METHOD,

but not entirely sure where in the code its gone wonky...

 

Thanks again for the contrib, but before i use it LIVE, i would love for it to be displaying properly :D

 

Many thanks in advance!!

Share this post


Link to post
Share on other sites

Has anyone seen this error before?

------------------------------

0 -

 

select p.products_id, p.products_price, p.products_length, p.products_weight, p.products_width, p.products_height, p.products_ready_to_ship, p.products_tax_class_id from products p where p.products_id in (34,)

 

[TEP STOP]

-------------------------------

I've checked and rechecked my install(v1.1 on OSC2.2) and the admin instructions but as I get to the part of the checkout process that is the shipping page, this error appears. Anybody had this problem?

 

I've got a couple of mods that might be interfering. PWA and UPS XML (that is what I believe all of those variables belong to in the error message.

 

Help? I'd really like to use this

Share this post


Link to post
Share on other sites
Did someone manage to add more than one type of gift wrap? This would make it possible for the client the choose for example a box or paper to giftwrap the product(s).

1. Copy-paste includes\modules\giftwrap\giftwrap.php and name it gift2.php

 

2. Open up and edit, and make the following changes:

 

class giftwrap -> class gift2

function giftwrap -> function gift2

$this->code = 'giftwrap'; -> $this->code = 'gift2';

 

Search and replace (Match Case) GIFT_ with GIFT2_ (17 occurences)

 

3. Copy-paste includes\languages\english\modules\giftwrap\giftwrap.php and name it gift2.php

 

Search and replace (Match Case) GIFT_ with GIFT2_ (3 occurences)

Rename text to something suitable

 

when a customer enters the checkout_shipping page he can select between "giftwrap" and "no giftwrap". "giftwrap" is selected by default, but i want "no giftwrap" to be the default value. i already tried to change the sort order of these two options in admin -> modules -> giftwrap, but "giftwrap" still appears on top and is selected by default. why can't i sort these options?

Also wondering how you make No Giftwrap selected by default? For me, No Giftwrap shows up on top (sort order 1, the other 2), however it is not selected by default.

Share this post


Link to post
Share on other sites

Has anbody get a solution to this problem.

I get this message in Order Totals Modules

Fatal error: Cannot redeclare class ot_giftwrap in /home/yxgblfan/public_html/includes/modules/order_total/ot_giftwrap.php on line 13

 

Line 13 says

class ot_giftwrap {

 

I am new to coding so do not understand what it is telling me other than it isnt working.

 

urgent help please I have used Giftwrap version1.1 in oscommerce 2.2


Liz

 

A very appreciative member still attempting to climb the steep learning curve!

Share this post


Link to post
Share on other sites

Think I have sorted it with 2 files in wrong folders


Liz

 

A very appreciative member still attempting to climb the steep learning curve!

Share this post


Link to post
Share on other sites
I just finish instaling the contrib.

 

and I was wandering if there is a way to check one of the options by default ?

 

 

I'm not certain if this is right, but seems the first time the checkout_shipping page is loaded (and no gift wrapping option has already been chosen) that the $giftwrap_info['id'] variable is blank. So I've changed the line of code where it outputs the form and is looking for a selected row to read:

 

if ( ($quotes1[$i]['id'] . '_' . $quotes1[$i]['methods'][$j]['id'] == $giftwrap_info['id']) || (tep_count_giftwrap_modules() == (int)1) || ( $i == 0 && $giftwrap_info['id'] == "" )) {

 

I've only tested it a little bit but I think it's ok, and choose the first option as the default if one of the options hasn't already been set. If you then go back and forth it sets the appropriate row as being chosen.

 

Please don't blame me if it's wrong because I'm a very tired coder today :)

 

cheers,

 

Dave

Share this post


Link to post
Share on other sites

I have read this all thread and still can't find the answer am looking for. I have installed this giftwrap mod and it all seems to be ok, how ever, even when i change the price for Giftwrap on the admin section is still shows as 0.00.

 

Can someone help me please how i can sort it out on the checkout_shipping.php page so that the giftwrap price shows, it seems to workf or no giftwrap.

 

Thank you

Share this post


Link to post
Share on other sites
I'm not certain if this is right, but seems the first time the checkout_shipping page is loaded (and no gift wrapping option has already been chosen) that the $giftwrap_info['id'] variable is blank. So I've changed the line of code where it outputs the form and is looking for a selected row to read:

 

if ( ($quotes1[$i]['id'] . '_' . $quotes1[$i]['methods'][$j]['id'] == $giftwrap_info['id']) || (tep_count_giftwrap_modules() == (int)1) || ( $i == 0 && $giftwrap_info['id'] == "" )) {

 

I've only tested it a little bit but I think it's ok, and choose the first option as the default if one of the options hasn't already been set. If you then go back and forth it sets the appropriate row as being chosen.

 

Please don't blame me if it's wrong because I'm a very tired coder today :)

 

cheers,

 

Dave

 

 

Hello Dave,

 

I modifed my code with yours and it does 'hightlight' the No Giftwrap with a colored bar but does not select the radio button. The user still has to click it to activate the radio button. Do you, or anyone else that knows more than I know a way to not only hightlight but activate the radio button too?

 

Thanks in advance.

Share this post


Link to post
Share on other sites

I love this contrib and see a ton of potential with it. Unfortunately I have only been running osCommerce for a month or so and am learning tons of new things every day. So I thought I would post my idea so that hopefully someone can add to this contrib.

 

In my business I have some things that are in stock and other things that are dropshipped. I was wondering if there would be a way to add the 'Giftwrap' option only to certain products. So if someone selected a product that is dropshipped I could turn off the giftwrap option for the customer. Either by not showing it at all or at checkout with a comment "No Giftwrap is available for this item".

 

In my guess I would imagine that there would have to be a code linked with the product listings?

 

Or if someone has an easier solution? I just hate the thought of not having this contrib running, but with my mixed inventory I might have to disable it. The other solution would be to refund the giftwrap charge when I got the order for a dropshipped item, but I fear that would just frustrate the customer. Better to NOT offer than to offer and then say 'NO'. lol

Share this post


Link to post
Share on other sites
Hello Dave,

 

I modifed my code with yours and it does 'hightlight' the No Giftwrap with a colored bar but does not select the radio button. The user still has to click it to activate the radio button. Do you, or anyone else that knows more than I know a way to not only hightlight but activate the radio button too?

 

Thanks in advance.

 

 

Dave, maybe it took a bit for it to work, but now it seems to be working. Selecting and activating the radio button too, but in the wrong way. It is now autoselecting Gift Wrap and I can't seem to figure out how to get it to select No Gift Wrap. I have switched sort orders in ADMIN to no avail it just follows Gift Wrap no matter what.

 

I changed the (int)1 to (int)2 and both Gift Wrap and No Gift Wrap highlighted but still with Gift Wrap toggled. I tried (int)0 and (int)3 and 4 to no avail ( again, I have no idea what the code means, just trying something. :) Please help! We are so close!

 

Here is the original code by Dave:

 

if ( ($quotes1[$i]['id'] . '_' . $quotes1[$i]['methods'][$j]['id'] == $giftwrap_info['id']) || (tep_count_giftwrap_modules() == (int)1) || ( $i == 0 && $giftwrap_info['id'] == "" )) {

 

Also I changed this code:

 

// one button is not an array
if (document.checkout_address.giftwrap[0]) {
  document.checkout_address.giftwrap[buttonSelect].checked=true;
} else {
  document.checkout_address.giftwrap.checked=true;
}
}

to this code

// one button is not an array
if (document.checkout_address.giftwrap[0]) {
  document.checkout_address.giftwrap[buttonSelect].checked=true;
} else {
  document.checkout_address.giftwrap.checked=false;
}
}

Share this post


Link to post
Share on other sites

Would anyone be able to modified this slightly to have an image showing when the customer chooses a giftwrapping as well as in checking _confirmation

Share this post


Link to post
Share on other sites

I have installed giftwrap 1.1 on an oscemmerce 2.2 060817 site and had it working fine. Now I have had to upgrade the site to 2.2 RC1 and have tried adding the required coding but I am floundering when it comes to the coding in catalog/includes/classes/order.php.

 

You say to look for the coding :-

if (DISPLAY_PRICE_WITH_TAX == 'true') {

	$this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];

  } else {

	$this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];

  }

}

 }

?>

 

and to then:-

----> INSERT this code:   + $this->info['giftwrap_cost'] prior to the; 

													 at the end of lines 2 and 4 (lines start with $this)<----

make sure you leave a blank space prior to the +

 

but the new coding in RC1 in this section has had to be adapted for PayPal express to work so is:-

if (DISPLAY_PRICE_WITH_TAX == 'true') {

	  $this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));

	  if (isset($this->info['tax_groups']["$products_tax_description"])) {

		$this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));

	  } else {

		$this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));

	  }

	} else {

I have tried adding the coding to the end of all three rows beginning with $this and before ';' but nothing seems to happen. I have activated modules but nothing is on ordering pages to do with giftwrap at all. Am I trying to do the impossible? Or have I got it wrapped round my ears I am a total newbie to coding and feeling my way along.

 

Hoping for advice, thanks in anticipation.

 

Regards

 

Liz


Liz

 

A very appreciative member still attempting to climb the steep learning curve!

Share this post


Link to post
Share on other sites
I have read this all thread and still can't find the answer am looking for. I have installed this giftwrap mod and it all seems to be ok, how ever, even when i change the price for Giftwrap on the admin section is still shows as 0.00.

 

Can someone help me please how i can sort it out on the checkout_shipping.php page so that the giftwrap price shows, it seems to workf or no giftwrap.

 

Thank you

 

I have the same issue and can't for the life of me work out how to pass the admin gift wrap price to the shipping page. Please could someone work out why?

 

This is where it is spitting out the cost but it doesn't give me MODULE_GIFT_COST

		$gift_tax_rate_tmp = tep_get_tax_rate(MODULE_ORDER_TOTAL_GIFTWRAP_TAX_CLASS);
	$gift_tax_amt_tmp = $quotes1[$i]['methods'][$j]['cost'];
	$gift_tax_amt_tmp += tep_calculate_tax($quotes1[$i]['methods'][$j]['cost'], $gift_tax_rate_tmp);
	?>
	<td class="main"><?php echo $currencies->format($gift_tax_amt_tmp); ?></td>

 

Possibly related to a latest release as the issue is cropping up a bit:

http://forums.oscommerce.com/index.php?showtopic=281922

http://forums.oscommerce.com/index.php?showtopic=259482

http://forums.oscommerce.com/index.php?showtopic=259306

 

Someone has posted that this might be a fix: http://forums.oscommerce.com/index.php?s=&...st&p=165023

Edited by Aussiepete

Share this post


Link to post
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
Sign in to follow this  

×