Order Options Section in Checkout

  • Posts: 131
  • Thank you received: 7
10 years 7 months ago #177046

-- HikaShop version -- : 2.3.0
-- Joomla version -- : 2.5

OK, so my client has asked me to add a new section in the checkout workflow which would allow a customer to add Gift Cards and Gift Wrapping to their order. It needs to be part of the checkout flow as it's very much an overall order enhancement value add.

So, to make this work I decided to use the Additional Information hook in the checkout flow and created a simple text field with a Modules Anywhere plug-in call to load a Hikashop Content Module which displays the order options products which I've created in two categories Greeting Cards and Gift Wrap. I used a language override to change the name from Additional Information to Your Order Options.

It works nicely - the value added products are displayed (screenshot attached).

BUT

The first product in the displayed Hikashop Content Module does not get added to the cart when Add to Cart is clicked. Instead it takes me back to the home page of the site. Every other product works and I do not know why!

ALSO

I'd like to find a way for Gift Wrapping to be made Free when the total order is over a certain amount? I thought I could do this using a Discount, but Discount does not provide a Restriction whereby it would apply the discount when the order is over a certain amount. How could I achieve this?

I can provide admin access to the website (which is on my staging server if needed) by PM if needed.

Your help as always is appreciated.

Attachments:

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
10 years 7 months ago #177055

Hi,

1. It's because you're displaying your content module inside the checkout and the checkout already has a form element around all the views of the checkout. And since each product has its own form for the add to cart, the first product's form get mixed up by the browser with the main form of the checkout and it doesn't behave properly.
One solution would be to add some custom HTML before your content module and after it to close the checkout form (and other html elements) before the content module HTML, and then open them again after it for the cart view and the next button below it. That way, you would get valid HTML and all the add to cart buttons of the module would work.

2. Discounts apply directly on the price of the products and thus cannot have global cart restrictions.
An alternative I can propose would be to create a coupon with the "auto load" option activated, the minimum order amount value and the gift wrapping product selected in its product option. The coupon would be then be loaded automatically during the checkout if the gift wrapping product would be in the cart and the total of the cart would be above the amount entered in the coupon.

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

  • Posts: 131
  • Thank you received: 7
10 years 7 months ago #177139

Hi Nicolas,

Thanks for the response. Forgot about autoloading coupons!

On the order options page - makes sense, couple of questions...

1. At the moment I simply have a {modulepos GreetingCard} call in my customtext field to load the Hikashop Content Module.
Can I simply put the close form code before my modulepos call, or will this get stripped? If stripped I could use the Sourcerer plug-in to
load it.

So, I'd end up with something that looks like this in my custom text field:

  <?php CLOSE CHECKOUT FORM CODE  ?>
   {modulepos OrderOptions}
   <?php OPEN CHECKOUT FORM CODE ?>

2. Is there existing code that I can use to do this? Where is it? If not, can you provide?

I do think that being able to add order options to add value to an order is useful and easiest is to present these as products, maybe this should be an optional part of the checkout flow - maybe something you'd consider for a future release?

Thanks

Last edit: 10 years 7 months ago by bonzomedia. Reason: clarity

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
10 years 7 months ago #177207

Hi,

1. If you're using a custom order field, then you could add instead your tag and the HTML tags around it in the "fields" file of the "checkout" view via the menu Display>Views . Just remove the code there which handles the custom order fields and put your stuff instead.

2. Regarding additional options during the checkout, the issue we have is that each user needs something else. In most cases, it can be handled between the shipping methods selection and the payment method selection, but to have something as complex as you have is really something custom and we cannot provide a general solution as far as I can see.
We do have triggers in the checkout API of HikaShop so you can create your own checkout step with a hikashop plugin in order to add whatever you want in the checkout, but it requires to be a developer to be able to do that.

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

  • Posts: 131
  • Thank you received: 7
10 years 7 months ago #177841

HI Nicolas,

OK following your suggestion I removed my module call from the custom checkout field and then edited my checkout->fields.php view to simply make the module call:

<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.3.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
 * @license  GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<div id="bonzoValueAdds">
  {modulepos GreetingCard}
</div>

So, my product module got displayed, but I got the same behaviour, i.e. that the 1st product in the product list would not add to cart.

So, I put a close form element in:
<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.3.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
 * @license  GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>

</form>
<div id="bonzoValueAdds">
  {modulepos GreetingCard}
</div>

...and this now allows me to add the 1st (and other products into the cart).

But, the problem is two things:-

1. Although the cart updates when I add a product, clicking the delete button causes the checkout to go back to the Login step.
2. If I proceed through the checkout to the next step (Shipping) and then to Payment the checkout goes back to the Login step and displays the following message:- "Please fill additional information" in the system message area.

I'm so close to making this work, I'm assuming I need to reopen a form. but I need some help to know which form and what the element code needs to be?

Last edit: 10 years 7 months ago by bonzomedia.

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
10 years 7 months ago #177845

Hi,

You nailed it. You need to reopen the form after your code, otherwise, the rest of the checkout after your module won't work.
The form is generated in the file "step" of the view "checkout" so you can get the code from there in order to reopen it.

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

  • Posts: 131
  • Thank you received: 7
10 years 7 months ago #177956

OK, so I took the open form code from step.php and applied it like this:-

<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.3.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
 * @license  GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>

</form>
<div id="bonzoValueAdds">
  {modulepos GreetingCard}
</div>
<?php
    if(empty($this->noform)){
echo 'Yes - loading form';
    ?>

    <form action="<?php echo hikashop_completeLink('checkout&task=step&step='.($this->step+1).$url_itemid); ?>" method="post" name="hikashop_checkout_form" enctype="multipart/form-data">
    <?php
    }
?>

My echo confirms that the form code is loaded but now it won't even progress onto the next step (Shipping) when I click the Next button, it returns me to the Login step. I can force the checkout to go to the Shipping step by clicking the Shipping link in the progress bar, but still get the Please fill additional information message and a return to the Login step. So, something is still not right even if I re-open the form using the code above...

Last edit: 10 years 7 months ago by bonzomedia.

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

  • Posts: 83995
  • Thank you received: 13605
  • MODERATOR
10 years 7 months ago #177971

You're probably missing some other closing/opening tags like divs/spans etc.

Please note that we're far from user support here.
The best would simply be to add your module on the checkout page with the menu assignment options of the module manager so that it would display outside of the checkout form altogether. That way, no customization needed and it will work pretty closely to what you want.

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

Time to create page: 0.065 seconds
Powered by Kunena Forum