Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Giftwrapping for osC GOLD and normal


Recommended Posts

Don't ask me why I did this module I was just curious to see if I could accomplish it or not.

And I felt that the current existing addons require way too many code changes.

 

I created a simple, just basics, Giftwrapping module based on the COD Fee module.

Installation is very, very simple. Database changes are done automatically with the installation/un-installation of the module.

You find more instructions regarding this feature inside the install manual.

This module works for both versions of osC, normal and bootstrap.

 

Be aware that this is just a alpha, beta....well.....you know.....a test version. So please test this well before using on a live store.

If you have ideas for improvements please share here in this topic.

 

I hope I didn't forget to mention anything important. And if you find any typos just post here. Thank you.

 

Download:

 

 

Link to comment
Share on other sites

Not sure but this should fix it.

 

For Bootstrap users only:

 

checkout_shipping.php

 

FIND:

<!-- BOF GIFTWRAP //-->
<?php
if (MODULE_ORDER_TOTAL_ALLOW_GIFTWRAP == 'true') {
?>
<div class="alert alert-success">
        <?php echo '<i class="fa fa-gift fa-2x"> </i><strong>' . TEXT_GIFTWRAP . '</strong><br><small>' . TEXT_HAVE_YOUR_ORDER_GIFT_WRAPPED .'</small>'; ?>
        <?php echo '<div style="float:right;">' . tep_draw_checkbox_field('gift_wrap', '1', (($gift_wrap == 'true') ? true : false), 'onclick="checkBox(\'gift_wrap\')"'); ?>
</div>
<?php
}
?>
<!-- EOF GIFTWRAP //-->

REPLACE WITH:

<!-- BOF GIFTWRAP //-->
<?php
if (MODULE_ORDER_TOTAL_ALLOW_GIFTWRAP == 'true') {
?>
<div class="alert alert-success">
        <?php echo '<i class="fa fa-gift fa-2x"> </i><strong>' . TEXT_GIFTWRAP . '</strong><br><small>' . TEXT_HAVE_YOUR_ORDER_GIFT_WRAPPED .'</small>'; ?>
        <?php echo '<div style="float:right;">' . tep_draw_checkbox_field('gift_wrap', '1', false) . '</div>'; ?>
</div>
<?php
}
?>
<!-- EOF GIFTWRAP //-->
Link to comment
Share on other sites

@@Tsimi

 

Hi Lambros

 

Thought Id give this module a go, However I got the following message when trying to install thru admin

 

Warning: Cannot modify header information - headers already sent by (output started at /home/grandp/public_html/BS234/includes/modules/order_total/ot_giftwrap.php:1) in /home/grandp/public_html/BS234/ADMIN/includes/functions/general.php on line 38

 

Any thoughts.

 

Cheers

 

Grandpa

 

Using latest BS234 download from GitHub

Link to comment
Share on other sites

@@grandpaj

 

Hi John

 

I just installed it on my live server test shop and when installing I don't get anything just a blank page and when I click the back button on my mouse or browser it shows the module installed. Same goes when uninstalling.

That doesn't mean that it is working because it is not suppose to install like that but in your case you must have either a Error message addon or you added this to your application top file

  // Set the level of error reporting
  error_reporting(E_ALL);
ini_set('display_errors', 1);

I added the above code to my appliaction_top.php file in the admin to see that error and any other error, and holy shit! I get all kinds of errors and that on a fresh install of osC.

For example

 

 

Notice: Undefined variable: SID in /home/xxxx/xxxx/public_html/xxxx/demo1/admin/includes/functions/html_output.php on line 48

 

no clue what that is and if it can be ignored but here is a topic about it.

 

http://www.oscommerce.com/forums/tracker/issue-693-e-notice-error-when-force-cookie-use-set-to-false-on-admin/

 

Anyway, for the life of me I cannot find the reason for this behaviour. I looked at it over and over again. Compared with the cod fee module and also other modules. There is nothing wrong that I can see. Maybe someone else would be so kind and look at this giftwrap module and tell us why it is not installing normally.

I had no issues at all with it on my local server though. Install/Uninstall went fine.

 

It also says ot_giftwrap.php:1 that would be line 1 of the file which is...<?php

Link to comment
Share on other sites

It was brought to my attention that if you save files in UTF-8 encoding you might get problems.

Both module files (module + lang file) were saved as UTF-8 and not "UTF-8 without BOM"!

So just open both files with Notepad++ or whatever you use and change the encoding to UTF-8 without BOM

 

Thanks @@burt for pointing it out! :thumbsup:

Link to comment
Share on other sites

@@Tsimi

 

Hi Lambros

 

The above files install with no problems (no nasty messages) looks really good.Well done.

However, all appears on checking_shipping.php

Giftwrap Service
Have your products gift wrapped. with the check box of to the right, but when ticking it and going to checkout nothing is charged, or shows

I have checked that the sort order number is lower than the order total sort number, not sure what to do. I have checked everything but must have missed something.

 

Cheers

 

John

Link to comment
Share on other sites

@@Tsimi

Hi lambros

 

I have the same sort order as you have above, still doesn't want to work.

 

One thing I do have but doubt that it would make a diff, is I do use a shipping  Zone, which is set up to only allow shipping within NZ. and the addon Store Pick Up.

 

Cheers

 

John

Link to comment
Share on other sites

@@Tsimi

 

Hi Lambros

 

You don't see any charges inside the checkout_confirmation page?  No None.

 

And you did apply the bootstrap fix from post #3.  Yes

 

Surely others must have tried this addon. I think its pretty much a must have.

 

Cheers

 

John

Link to comment
Share on other sites

Hmmm, that is strange. You did apply all changes of code to the checkout_shipping.php and checkout_process.php right?

 

You can take a look at my test shop here. Check Shop

 

Test account login is

username: test at test dot com (can't write the mail address here since it thinks i am mentioning a member)

psw: 123456

Link to comment
Share on other sites

@@Tsimi

 

Hi Lambros

 

Your site works just fine. Don't know what Ive done, but must have missed something.

 

Ive taken the liberty of sending you a PM

 

Many thanks

 

John

Link to comment
Share on other sites

@@Tsimi

 

Hey Lambros

 

Regarding your post #19

 

Do you just simply upload the new package or does the previous package need to be completley uninstalled, including the DB

 

Cheers

 

John

Link to comment
Share on other sites

@@grandpaj

 

Uninstall the module first then replace the ot_giftwrap.php files. Don't forget to replace the one from the language folder too.

Then look at the install manual and copy the code from Step 1e to your checkout_shipping.php and add the new language definition into the english/checkout_shipping.php

 

Then install the module again.

Link to comment
Share on other sites

  • 4 weeks later...

The installation for this file says this as step one:

 

STEP 1.) catalog/checkout_shipping.php
*****************************************

STEP 1a.)
FIND: (around line 109)

if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

ADD AFTER:

// BOF GIFTWRAP
 if (!tep_session_is_registered('gift_wrap')) tep_session_register('gift_wrap');
      $gift_wrap = isset($HTTP_POST_VARS['gift_wrap']) ? true : false;
// EOF GIFTWRAP

 

 

BUT the file actually has this: 

    if (!isset($_SESSION['shipping'])) tep_session_register('shipping');
 

Is this mod written for a different version of Gold BS?

Link to comment
Share on other sites

Just downloaded a fresh copy of GOLD and the code is there as mentioned in the manual. So either you are looking at a different file or the wrong place?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...