Zen Cart Logo

minimum amount

Views: 10,015

Results 41 to 59 of 59
14 May 2011, 11:27 AM
#41
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

minimum amount

Hi Ajeh, I thought I had this working, but it's actually causing a problem that I hadn't noticed until now. Let me try and explain using some logic bullet points so you can understand what's happening :)

  • all products on https://www.silkblooms.co.uk have a product weight assigned that's > 0 (apart from product 1652)

  • product ID 1652 has been customised as an incremental value product so that people can enter a value into their cart and checkout (thereby paying an instalment towards tehir account balance) it's weight set to 0 so I can manipulate behaviour below

  • I'm using a modified vesrsion of the accountholder mod as a way of letting people check out on a payment plan if their cart value is > 100.00 (works perfectly). If their cart is < 100.00 it does not appear if (!IS_ADMIN_FLAG && $order->info['subtotal'] < 100.00 {$this->enabled = false;} (works perfectly)

  • I'm **trying **to prevent the accountholder mod from appearing as an option when people only have product ID 1652 in their cart (when they're paying an instalament towards their outstanding balance, I don't want them being able to select 'Pay by Instalments' as an option). This is what's causing the problems. I thought I had this working but I hadn't noticed the problem our coding has caused, until now.

Here is a copy of the PHP used to modify the accountholder.php file:

// class constructor
    function accountholder() {
      global $order;

      $this->code = 'accountholder';
      $this->title = MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_TITLE;
      if (IS_ADMIN_FLAG === true && (MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO == 'Just pay the rest when you can' || MODULE_PAYMENT_ACCOUNTHOLDER_PAYTO == '')) $this->title .= '<span class="alert"> </span>';
      $this->description = MODULE_PAYMENT_ACCOUNTHOLDER_TEXT_DESCRIPTION;
      $this->sort_order = MODULE_PAYMENT_ACCOUNTHOLDER_SORT_ORDER;
      $this->enabled = ((MODULE_PAYMENT_ACCOUNTHOLDER_STATUS == 'True') ? true : false);
	  if (!IS_ADMIN_FLAG) {
  global $cart;
  if ($_SESSION['cart']->show_weight() == 0) {
    $this->enabled = false;
  }
}
	  
	  // bof: disable based on Order Amount
// use $order->info['subtotal'] or $order->info['subtotal']
if (!IS_ADMIN_FLAG && $order->info['subtotal'] < 100.00) {
$this->enabled = false;
}

// eof: disable based on Order Amount 

As I say, I thought this was working and to a certain extent it is. When a product is added to the cart and it's weight is 0kg then the acountholder.php (pay by instalments) is not showing as an option at the checkout confirmation page. Great, but it's doing something to all other procuts too!!

When I add a normal product to my cart with weight >0 it's somehoe causing the cart summart to display as 0kg (even though product weight is definitely > 0). Then when I add product ID 1652 to the cart it starts to calculate the other produc'ts weight correctly.

I hope you can understand my problem. I've tried to be as concise as possible in the hope that you can see what's wrong and shed some of your wisdom on this for me once more?

14 May 2011, 11:54 AM
#42
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: minimum amount

Ignore this Ajeh, turns out I had selected "Yes, Always Free Shipping" in most of my products which is why it's displaying 0kg!! Duuuuuuh!! It had nothing to do with our modifications!!

14 May 2011, 12:45 PM
#43
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: minimum amount

Thanks for the update that you have this fixed now ... :smile:

26 Jan 2013, 6:58 PM
#44
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: minimum amount

limelites:

Getting something, here's the code I inserted in the tpl_checkout_split.php file, just about the PAYPAL fieldset:

<?php if ($order->info['total'] < 100.00) { ?> <div class="alertInstalmentsShadowedOut"><?php echo zen_image(DIR_WS_TEMPLATE.'images/instalments_shadowed_out.gif'); ?></div> <?php } ?> <br class="clearBoth" /> ``` > > Definitely working, I just need to style it in CSS now, so it appears in the correct position. > > Thank you Ajeh!! I knoew you'd have the right tricks up your sleeve for this one. You underestimate yourself :)

Hi Ajeh,

Are you still watching this thread? Not sure if you remember this but if you are watching it then maybe you can figure out what might have caused this so tstop working? It was working a few days ago but now it's not and I can't think why as it's still coded into the tpl_checkout_split.php file like this:

 <?php if ($order->info['total'] < 100.00) { ?>

                                    <div class="alertInstalmentsShadowedOut"><?php echo zen_image(DIR_WS_TEMPLATE . 'images/instalments_shadowed_out.gif'); ?></div>

                                        <?php } ?>

Can't figure out why it would have just stopped working. It's as though a different file is generating the checkout page now?! Weird!

26 Jan 2013, 7:33 PM
#45
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: minimum amount

Put this code about the IF:

<?php echo 'ORDER TOTAL: ' . $order->info['total'] . ($order->info['total'] < 100 ? 'YES' : ' NO') . '<br>';?>
26 Jan 2013, 10:03 PM
#46
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: minimum amount

Ajeh:

Put this code about the IF:

<?php echo 'ORDER TOTAL: ' . $order->info['total'] . ($order->info['total'] < 100 ? 'YES' : ' NO') . '<br>';?>

I don't even understand what that did but it certainly did the trick!  I just changed it to:

```php
<?php if ($order->info['total'] < 100.00 ? 'YES' : ' NO') { ?>
<div class="alertInstalmentsShadowedOut"><?php echo zen_image(DIR_WS_TEMPLATE . 'images/instalments_shadowed_out.gif'); ?></div>
<?php } ?>

Thank you Ajeh, this forum would be an altogether different place without your genius!

26 Jan 2013, 11:35 PM
#47
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: minimum amount

Sorry you are not using that right:

<?php echo 'ORDER TOTAL: ' . $order->info['total'] . ($order->info['total'] < 100 ? 'YES' : ' NO') . '<br>';?>
 <?php if ($order->info['total'] < 100.00) { ?>

                                    <div class="alertInstalmentsShadowedOut"><?php echo zen_image(DIR_WS_TEMPLATE . 'images/instalments_shadowed_out.gif'); ?></div>

                                        <?php } ?>

The point is to echo the content of $order->info['total'] where you are using that for you current IF ...

27 Jan 2013, 12:05 AM
#48
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: minimum amount

Ajeh:

Sorry you are not using that right:

<?php echo 'ORDER TOTAL: ' . $order->info['total'] . ($order->info['total'] < 100 ? 'YES' : ' NO') . '<br>';?> <?php if ($order->info['total'] < 100.00) { ?>
                                <div class="alertInstalmentsShadowedOut"><?php echo zen_image(DIR_WS_TEMPLATE . 'images/instalments_shadowed_out.gif'); ?></div>

                                    <?php } ?>
> 
> The point is to echo the content of  $order->info['total'] where you are using that for you current IF ...

It was working a few days ago though, with just this:

```php
  <?php if ($order->info['total'] < 100.00) { ?> 

Nothing had changed so couldn't understand why it just stopped working and now requires this:

 <?php if ($order->info['total'] < 100.00 ? 'YES' : ' NO') { ?> 
27 Jan 2013, 12:15 AM
#49
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: minimum amount

If does NOT require that ...

That extra code is just to see if where you are testing the amount that it is actually an amount that can be used in your IF ...

Example, if $order->info['total'] was not defined or was set to something odd like 0, when it should be 125.75 where you are using it, then that would help you know it is set correctly for your needs ...

27 Jan 2013, 10:20 AM
#50
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: minimum amount

Ajeh:

If does NOT require that ...

That extra code is just to see if where you are testing the amount that it is actually an amount that can be used in your IF ...

Example, if $order->info['total'] was not defined or was set to something odd like 0, when it should be 125.75 where you are using it, then that would help you know it is set correctly for your needs ...

That's what I thought. It's quite weird because up until a few days ago, it was working perfectly well with:

<?php if ($order->info['total'] < 100.00) { ?>

The shadowed out image was being displayed as it should, whenever the total vallue of the cart contents was <100. Then, for no reason it stopped working.

As soon as I changed it to this:

  <?php if ($order->info['total'] < 100.00 ? 'YES' : ' NO') { ?> 

It started to work.

I've re-tested just now with the exact same cart contents in each test, logged in as the same person each time. As soon as I remove the** ? 'YES' : ' NO'** part, it stops displaying the image. So, in this case it seems it's required? Just can't figure out why. At least it's working though, which is good.

27 Jan 2013, 2:45 PM
#51
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: minimum amount

When you change your code to be:

<?php echo 'ORDER TOTAL: ' . $order->info['total'] .  ($order->info['total'] < 100 ? 'YES' : ' NO') . '<br>';?>
 <?php if ($order->info['total'] < 100.00) { ?>

                                    <div  class="alertInstalmentsShadowedOut"><?php echo  zen_image(DIR_WS_TEMPLATE . 'images/instalments_shadowed_out.gif');  ?></div>

                                        <?php } ?>

[/CODE]

You should see on the screen an echo of:
ORDER TOTAL: YES (when order total is < 100)
-- or --
ORDER TOTAL: NO (when order total is >= 100)

What do you see using the code above?

27 Jan 2013, 2:56 PM
#52
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: minimum amount

Ajeh:

When you change your code to be:

<?php echo 'ORDER TOTAL: ' . $order->info['total'] . ($order->info['total'] < 100 ? 'YES' : ' NO') . '<br>';?> <?php if ($order->info['total'] < 100.00) { ?>
                                <div  class="alertInstalmentsShadowedOut"><?php echo  zen_image(DIR_WS_TEMPLATE . 'images/instalments_shadowed_out.gif');  ?></div>

                                    <?php } ?>
> \[/CODE]
> 
> You should see on the screen an echo of:
> ORDER TOTAL: YES (when order total is < 100)
> -- or --
> ORDER TOTAL: NO (when order total is >= 100)
> 
> What do you see using the code above?


When I change to the above code I do not see any message if the cart contents are <100.  I do see the instalments_shadowed_out.gif image but nothing else.  

When cart contents are >100 then it shows the instalments payment option as a radio button (as it should) but then it also now shows ORDER TOTAL: 189.98 NO
27 Jan 2013, 3:00 PM
#53
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: minimum amount

Just noticed that the shadowed out image also shows when the cart contents are >100 (it shouldn't)

27 Jan 2013, 3:08 PM
#54
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: minimum amount

Let's back up a step or two ...

What file is this code in?

If you do a search in the Tools ... Developers Tool Kit ... for the image:
instalments_shadowed_out.gif

and select Catalog and click search ...

What comes up for that?

27 Jan 2013, 3:22 PM
#55
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: minimum amount

/includes/templates/MYCUSTOM/templates/tpl_checkout_split.php

This is the only file with that image. It's only referred to once and it's the code I've been pasting in the PHP above.

27 Jan 2013, 3:25 PM
#56
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: minimum amount

Could you post that file so we can see the whole thing?

27 Jan 2013, 4:05 PM
#57
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: minimum amount

I've just noticed something that changes my suspicions of the culprit here. The original code is working just fine! I can't pinpoint the exact problem. I'll post the file contents below but I don't think it's this file at all now. It's really weird, let me illustrate.

I had been testing with these four products in the cart: 5524, 3616, 3617 and 5527. Cart total just a little under £100.00. The reason I used those products was t customer emailed asking about the pay by instalments. She should have seen the shadowed out image and not needed to email but when she emailed I thought I'd see why. When these four products are in the cart, then the image does not show. I've only just now noticed that when I remove 5527 then it shows the image again!

OK, so you'd think it's got to be the 5527 product listing that's causing it somehow, right? Problem is, when 5527 is in the cart on it's own the image actaully shows.

Really weird! Test it yourself and you'll see. I don't think it's this file any more, but just in case:

http://www.silkblooms.co.uk/tpl_checkout_split.rar

27 Jan 2013, 5:22 PM
#58
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: minimum amount

Is this from some add on that you are using? It has been a long day already and I am running out soon and got myself a tad lost ... :lookaroun

27 Jan 2013, 5:33 PM
#59
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: minimum amount

Ajeh:

Is this from some add on that you are using? It has been a long day already and I am running out soon and got myself a tad lost ... :lookaroun

tpl_checkout_split.php is from the Fast and Easy Checkout module, yes sorry. Really don't think that's the problem now though.

OK, enjoy your night Ajeh. Hope you're off somewhere nice :)