LemonStand Forum: Skipping Shipping Choice - LemonStand Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Skipping Shipping Choice

#1 User is offline   Jez-Timms 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 144
  • Joined: 01-November 09

Posted 02 September 2010 - 10:09 AM

If there is ONLY ONE method of shipping and one rate, be that paid or free - how do you skip the part in the checkout process, as it is not needed?
0

#2 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 3,330
  • Joined: 31-October 09

Posted 02 September 2010 - 05:34 PM

Hi, Jez,

On the checkout page, in the Post Action Code field paste the following:

$options = Shop_ShippingOption::create()->where('enabled = 1')->find_all();
if ($options->count == 1 && $options[0]->get_shippingtype_object() instanceof Shop_TableRateShipping)
  Shop_CheckoutData::set_shipping_method($options[0]->id);


In the shop:checkout_shipping_info partial add the following hidden field:

<input type="hidden" name="skip_to" value="payment_method"/>


In the shop:checkout_progress partial comment out the following line in the steps array declaration:

'shipping_method' => 'Shipping Method',


Thanks

#3 User is offline   Jez-Timms 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 144
  • Joined: 01-November 09

Posted 07 September 2010 - 01:42 AM

Hi A,

Perfect works a treat thank you so much :)
0

#4 User is offline   Jez-Timms 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 144
  • Joined: 01-November 09

Posted 07 September 2010 - 02:41 AM

Any reason why this would not work?

Trying to number the checkout stages with an ordered list:

<ol class="progress" start="1">
<?
  $current_found = false;
  foreach ($steps as $step=>$name):
    $is_current = $checkout_step == $step;
    $current_found = $current_found || $is_current;
?>
  <li <? if ($is_current): ?>class="current"<? endif ?>>
    <? if ($current_found): ?>
      <?= h($name) ?>
    <? else: ?>
      <a href="#" onclick="return $(this).getForm().sendRequest('on_action', {update:{'checkout_page': 'checkout_partial'}, extraFields: {'move_to': '<?= $step ?>'}})"><?= h($name) ?></a>
    <? endif ?>
  </li>
<?
  endforeach
?>
</ol>


No numbers are being rendered at all...
0

#5 User is offline   Eric 

  • Developer
  • Group: +Administrators
  • Posts: 1,201
  • Joined: 04-August 10

Posted 07 September 2010 - 02:27 PM

Quote

Any reason why this would not work?
...
No numbers are being rendered at all...


That is because in /resources/css/styles.css it has this:

li
{
  list-style-type:none;
}


You need to add a list-style-type to ul.progress li {}

Check here for a list of options: http://www.w3schools...-style-type.asp

#6 User is offline   Jez-Timms 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 144
  • Joined: 01-November 09

Posted 09 September 2010 - 03:15 AM

Erm thanks but it is set as:

list-style-type: decimal;
0

#7 User is offline   Jez-Timms 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 144
  • Joined: 01-November 09

Posted 09 September 2010 - 03:21 AM

Anyway - Aleksey:

Skipping the shipping choice works as it should - now trying to skip the payment option as there is only one:

1. Added
<input name="auto_skip_to" value="review" type="hidden"/>
to the shop:checkout_payment_method

2. My post action code for the Checkout page looks like:

$options = Shop_ShippingOption::create()->where('enabled = 1')->find_all();
if ($options->count == 1 && $options[0]->get_shippingtype_object() instanceof Shop_TableRateShipping)
  Shop_CheckoutData::set_shipping_method($options[0]->id);
$default_method = Shop_PaymentMethod::find_by_api_code('default');
Shop_CheckoutData::set_payment_method($default_method->id);


3. Commented out the Payment Method in the shop:checkout_progress partial.

4. Added an API name of default to the only payment method.

But it is still giving me the option to choose the method and not skipping. What am I missing?
0

#8 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 3,330
  • Joined: 31-October 09

Posted 09 September 2010 - 03:29 PM

Hi, Jez!

The code on the Checkout page looks good. You also need to add the skip_to hidden field to the Shipping Method step:

<input type="hidden" value="review" name="skip_to"/>


But there could be a problem if you are going to skip both payment and shipping methods. In this case you need to put the skip_to field to the Shipping Information checkout step partial, but it should be there only in case if the shipping method should be skipped. But as I explained you in the email, it is difficult to skip the shipping method in your store, because it depends on the customer's location.

Thanks

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users