Gift wrap add to basket

  • Posts: 7
  • Thank you received: 1
9 years 5 months ago #205164

-- HikaShop version -- : 2.1.3
-- Joomla version -- : 2.5.28
-- Error-message(debug-mod must be tuned on) -- : Gift wrap add to basket

I have a gift wrap option I'm using personal_note and have a gift wrap product.
After checkout is clicked, I need that page to show a Next button that will both save the personal_note for the giftwrap and add the giftwrap to basket on the condition that the personal_note has been filled out. If not it should go through to checking out without charging the customer.

I'm using a custom template and have the code:

<a href="<?php if (isset($personal_note)) { echo "index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id=797&$personal_note"; } ?>" > next </a>
<?php else { ?>
<a href="index.php?option=com_hikashop&ctrl=1&Itemid=<?php $Itemid ;?>">Next</a>
<?php } ?>

I seem to be getting this error:

Parse error: syntax error, unexpected 'else' (T_ELSE) in /home/sites/polyspiraldev.co.uk/public_html/jhjoomla/templates/rt_afterburner_j16/html/com_hikashop/checkout/address.php on line 73

on the page so I know there is something wrong, I'm sure I have some of the variables wrong to.

Would appreciate any help

Last edit: 9 years 5 months ago by sudburydev.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
9 years 5 months ago #205176

Hello,

I have a gift wrap option I'm using personal_note and have a gift wrap product.

Note that this is actually possible to do it without any code customization, you'll just have to use custom fields which are form the "Item" table and which are available through the business version of Hikashop.

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 1
9 years 5 months ago #205260

As I said I have that already, that is working but it it needs to add it to the cart and charge for it

Last edit: 9 years 5 months ago by sudburydev.

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 1
9 years 5 months ago #205301

<div>
     <?php if (isset($personal_note)) { ?>
<a href="<?php echo "index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id=797&$personal_note"; ?>" > next </a>
 <?php } else { ?>
  <a href="index.php?option=com_hikashop&ctrl=1&Itemid=<?php $Itemid ;?>">Next</a>
  <?php } ?>
   </div>

I've been given this code from Hikashop themselves, which gave me these errors:
Thanks, I now get this error if I fill in the personal note or if I don't with that code

the URL it returned from the next button was: index.php?option=com_hikashop&ctrl=1&Itemid=

404 - Page not found : 1
You may not be able to visit this page because of:

an out-of-date bookmark/favourite
a search engine that has an out-of-date listing for this site
a mistyped address
you have no access to this page
The requested resource was not found.
An error has occurred while processing your request.
Please try one of the following pages:

Home Page
If difficulties persist, please contact the System Administrator of this site and report the error below..


I've replied to them, but if anyone here can solve this that would be great.

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 5 months ago #205269

Hi,

So once you have created your two custom item fields, the first one to say if we add a gift wrap and the second displayed based on the value of the first one thanks to the option "Display limited to ", second field which allow to set the text for the gift; you will have to create a custom plugin which will allow to add a charge in the cart based on the value of the custom item field.

Here is the developer documentation:http://www.hikashop.com/support/support/documentation/62-hikashop-developer-documentation.html
The plugin "HikaShop Donation plugin" can be taken as example.

If you are not a developer, you can still post your request in the commercial jobs section of this forum.

Regarding the other issue, please replace:

<a href="index.php?option=com_hikashop&ctrl=1&Itemid=<?php $Itemid ;?>">Next</a>
By:
<a href="index.php?option=com_hikashop&ctrl=product&Itemid=<?php $Itemid ;?>">Next</a>
But please give us the link of the topic giving that code, what was its goal ?

Last edit: 9 years 5 months ago by Xavier.

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 1
9 years 5 months ago #205403

Thanks, this just seems to refresh the page, the isset isn't working either ​as I've put in:

<?php if (isset($personal_note)) { ?>
 [b]   Personal note set[/b]
<a href="<?php echo "index.php?option=com_hikashop&ctrl=product&task=updatecart&quantity=1&checkout=1&product_id=797&$personal_note"; ?>" > next </a>
 <?php } else { ?>
<a href="index.php?option=com_hikashop&ctrl=product&Itemid=<?php $Itemid ;?>">Next</a>
  <?php } ?>

If it's adding to to the cart (when I get this working) I don't see why I need to create a custom plugin?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 5 months ago #205407

Hi,

Please give us more details on that code, where has it been added ? which view ?
If it is in the "checkout / address" one, I don't think it is the best place as this will not check all the products of the cart, and the variables are not correct.

This could be indeed a good solution, but I think that the best place to put the code will be in the view "checkout / step", then on a precise step parse all the products to see the value of their custom fields, based on that count how many gift wrap to add and finally replace the current "next" button code by the one adding product to cart, but this will only add to the cart and not redirect to the next step.

So I really think that a little plugin, not so hard to make, will do the job perfectly ;)

Another question, do you need one gift wrap per product or per order ?

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 1
9 years 5 months ago #205512

Thanks Xavier, It was in address.php, where abouts should I put it in step.php?

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
9 years 5 months ago #205517

The code will have to be heavily adapted to put it in checkout/step.
Please note that this is a user support forum. While we're happy to answer questions and give you guidelines, it's up to you to do the development you need to do.

Please Log in or Create an account to join the conversation.

  • Posts: 7
  • Thank you received: 1
9 years 5 months ago #205605

Thanks, I'v posted it in the commercial section on here and on oDesk

Thanks for your help

Please Log in or Create an account to join the conversation.

Time to create page: 0.098 seconds
Powered by Kunena Forum