Jump to content
Jack_mcs

Daily Specials

Recommended Posts

Did you install the Easy Discount module in admin->Modules->Order Total?

 

I've checked and tried everything again and again! No Discount!

Is there a debug mode or something else to find out why the discount will not be applied?

 

for your help I would really appreciate!

 

Thanks in advance

Share this post


Link to post
Share on other sites

I've checked and tried everything again and again! No Discount!

Is there a debug mode or something else to find out why the discount will not be applied?

 

for your help I would really appreciate!

 

Thanks in advance

Is the special showing up on the shop? If so, then you probably aren't meeting the conditon of the sale. If not, then something isn't enabled. You have to enable the contribution in admin->Configuratin, admin->moduls and admin->Daily Specials.

Share this post


Link to post
Share on other sites

Is the special showing up on the shop? If so, then you probably aren't meeting the conditon of the sale. If not, then something isn't enabled. You have to enable the contribution in admin->Configuratin, admin->moduls and admin->Daily Specials.

 

Thanks, everything is enabled and the special is showing up.

 

The conditions are: CartQuantity -> greater than -> 0, cupon amount -> 10%

if i put an item into the shopping cart -> no discount Logged in or not, always the same!

I've really no idea

Share this post


Link to post
Share on other sites

Getting this error....Fatal error: Call to a member function count() on a non-object in /includes/boxes/shopping_cart.php on line 76...And this error...Fatal error: Call to a member function clear() on a non-object in includes/modules/daily_specials_cart.php on line 59...when I remove the modification form includes/boxes/shopping_cart...Thanks in advance for the help...FYI I do have options types installed..

Edited by booker3672

Share this post


Link to post
Share on other sites

Thanks, everything is enabled and the special is showing up.

 

The conditions are: CartQuantity -> greater than -> 0, cupon amount -> 10%

if i put an item into the shopping cart -> no discount Logged in or not, always the same!

I've really no idea

What happens if you try some other condition, like quantity > 1? Do you have a category or product set in the special?

Share this post


Link to post
Share on other sites

Getting this error....Fatal error: Call to a member function count() on a non-object in /includes/boxes/shopping_cart.php on line 76...And this error...Fatal error: Call to a member function clear() on a non-object in includes/modules/daily_specials_cart.php on line 59...when I remove the modification form includes/boxes/shopping_cart...Thanks in advance for the help...FYI I do have options types installed..

Those are part of the Easy Discount module. Be sure you have uploaded those files and installed that module in admin, as mentioned a few posts ago.

Share this post


Link to post
Share on other sites

What happens if you try some other condition, like quantity > 1? Do you have a category or product set in the special?

 

I've tested many various conditions and no, there are no categories, no Products and no sides selected.

Share this post


Link to post
Share on other sites

I've tested many various conditions and no, there are no categories, no Products and no sides selected.

In includes/functions/daily_specials, please find this code

        $amt = $workArry['price'] * ($ds['coupon_amount'] / 100);

    if (tep_not_null($ds['condition1']) && tep_not_null($ds['condition2']) && tep_not_null($ds['condition3']))
    {   
       $cond = ($ds['condition1'] == TEXT_COUPON_CONDITION_CART_QTY) ? sprintf("%d", (($workArry['qty'] > 0 && ! $forceZero) ? $workArry['qty'] : (($forceZero) ? 0 : $cart->count_contents()))) : sprintf("%d", (($workArry['price'] > 0 && ! $forceZero) ? $workArry['price'] : (($forceZero) ? 0 : $cart->show_total())));   
       $oper = ($ds['condition2'] == TEXT_COUPON_CONDITION_EQL) ? " == " : " > ";
       $cmpamt = $ds['condition3'];
       $doit = ($amt > 0) ? '&& 1' : '&& 0'; //enable/disable based on discount
       return (tep_not_null($cmpamt) ? eval('return '.$cond.' '.$oper.' '.$cmpamt . ' ' . $doit .';') : 0);   

and replace it with this code

 

        $amt = $workArry['price'] * ($ds['coupon_amount'] / 100);

   print_r($workArry).'<br>';
   ?> <pre> <?php
print_r($ds);
?> </pre> <?php

    if (tep_not_null($ds['condition1']) && tep_not_null($ds['condition2']) && tep_not_null($ds['condition3']))
    {   
       $cond = ($ds['condition1'] == TEXT_COUPON_CONDITION_CART_QTY) ? sprintf("%d", (($workArry['qty'] > 0 && ! $forceZero) ? $workArry['qty'] : (($forceZero) ? 0 : $cart->count_contents()))) : sprintf("%d", (($workArry['price'] > 0 && ! $forceZero) ? $workArry['price'] : (($forceZero) ? 0 : $cart->show_total())));   
       $oper = ($ds['condition2'] == TEXT_COUPON_CONDITION_EQL) ? " == " : " > ";
       $cmpamt = $ds['condition3'];
       $doit = ($amt > 0) ? '&& 1' : '&& 0'; //enable/disable based on discount
    echo 'result '.$cond.' '.$oper.' '.$cmpamt ;   
       return (tep_not_null($cmpamt) ? eval('return '.$cond.' '.$oper.' '.$cmpamt . ' ' . $doit .';') : 0);  

Then add the items to your shopping cart and view the shopping cart. Something should be displayed. Please let me know what that is.

Share this post


Link to post
Share on other sites

In includes/functions/daily_specials, please find this code

        $amt = $workArry['price'] * ($ds['coupon_amount'] / 100);

    if (tep_not_null($ds['condition1']) && tep_not_null($ds['condition2']) && tep_not_null($ds['condition3']))
    {   
       $cond = ($ds['condition1'] == TEXT_COUPON_CONDITION_CART_QTY) ? sprintf("%d", (($workArry['qty'] > 0 && ! $forceZero) ? $workArry['qty'] : (($forceZero) ? 0 : $cart->count_contents()))) : sprintf("%d", (($workArry['price'] > 0 && ! $forceZero) ? $workArry['price'] : (($forceZero) ? 0 : $cart->show_total())));   
       $oper = ($ds['condition2'] == TEXT_COUPON_CONDITION_EQL) ? " == " : " > ";
       $cmpamt = $ds['condition3'];
       $doit = ($amt > 0) ? '&& 1' : '&& 0'; //enable/disable based on discount
       return (tep_not_null($cmpamt) ? eval('return '.$cond.' '.$oper.' '.$cmpamt . ' ' . $doit .';') : 0);   

and replace it with this code

 

        $amt = $workArry['price'] * ($ds['coupon_amount'] / 100);

   print_r($workArry).'<br>';
   ?> <pre> <?php
print_r($ds);
?> </pre> <?php

    if (tep_not_null($ds['condition1']) && tep_not_null($ds['condition2']) && tep_not_null($ds['condition3']))
    {   
       $cond = ($ds['condition1'] == TEXT_COUPON_CONDITION_CART_QTY) ? sprintf("%d", (($workArry['qty'] > 0 && ! $forceZero) ? $workArry['qty'] : (($forceZero) ? 0 : $cart->count_contents()))) : sprintf("%d", (($workArry['price'] > 0 && ! $forceZero) ? $workArry['price'] : (($forceZero) ? 0 : $cart->show_total())));   
       $oper = ($ds['condition2'] == TEXT_COUPON_CONDITION_EQL) ? " == " : " > ";
       $cmpamt = $ds['condition3'];
       $doit = ($amt > 0) ? '&& 1' : '&& 0'; //enable/disable based on discount
    echo 'result '.$cond.' '.$oper.' '.$cmpamt ;   
       return (tep_not_null($cmpamt) ? eval('return '.$cond.' '.$oper.' '.$cmpamt . ' ' . $doit .';') : 0);  

Then add the items to your shopping cart and view the shopping cart. Something should be displayed. Please let me know what that is.

 

Many thanks for your efforts!

Here is the output:

Array ( [price] => 44.45 [qty] => 0 )

Array
(
   [unique_id] => 1
   [special_name] => Example of Text Special
   [page_type] => 1
   [page_text] => 


   [popup_text] => Save 10% on all direction arrows - Today Only
   [alt_text] => 
   [image] => 
   [categories] => 
   [pages] => 
   [products_list] => 
   [condition1] => Cart Quantity
   [condition2] => Greater Than
   [condition3] => 0
   [coupon_amount] => 10%
   [date_start] => 2010-02-23 00:00:00
   [date_stop] => 2019-03-13 00:00:00
   [recur_days] => 
   [recur_mode] => 0
   [test_mode] => 0
   [use_css] => 0
   [language_id] => 99
)


result 44 > 0 

Share this post


Link to post
Share on other sites

Many thanks for your efforts!

Here is the output:

That's all correct so please try this. In shopping_cart.php, find

     /*** Begin Daily Specials ***/
     if ($easy_discount->count() > 0) {

 

and change it to

      /*** Begin Daily Specials ***/     

?> <pre> <?php
print_r($easy_discount->get_all());
?> </pre> <?php  
     if ($easy_discount->count() > 0) {

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

That's all correct so please try this. In shopping_cart.php, find

     /*** Begin Daily Specials ***/
     if ($easy_discount->count() > 0) {

 

and change it to

      /*** Begin Daily Specials ***/     

?> <pre> <?php
print_r($easy_discount->get_all());
?> </pre> <?php  
     if ($easy_discount->count() > 0) {

 

Here is the output:

Array
(
)

Share this post


Link to post
Share on other sites

Here is the output:

Array
(
)

OK. Try one more thing. In includes/modules/daily_specials_cart.php, find

$comparison = CheckConditions($ds, $cart, $amt);

and add this below it

   ?> <pre> <?php
print_r($ds);
?> </pre> <?php

Share this post


Link to post
Share on other sites

here is the output

 

Array
(
   [unique_id] => 1
   [special_name] => Example of Text Special
   [page_type] => 1
   [page_text] => 

   [popup_text] => Save 10% on all direction arrows - Today Only
   [alt_text] => 
   [image] => 
   [categories] => 
   [pages] => 
   [products_list] => 
   [condition1] => Cart Quantity
   [condition2] => Greater Than
   [condition3] => 0
   [coupon_amount] => 10%
   [date_start] => 2010-02-23 00:00:00
   [date_stop] => 2019-03-13 00:00:00
   [recur_days] => 
   [recur_mode] => 0
   [test_mode] => 0
   [use_css] => 0
   [language_id] => 99

Share this post


Link to post
Share on other sites

OK. This is the last, last change. :) In that same file, find this

              switch ($ds['condition1'])
             {
                case TEXT_COUPON_CONDITION_CART_TOTAL:
                   if ($comparison) 
                   {
                       $easy_discount->set('DS_CTTL',$ds['special_name'], $amt);
                       $dsClear = false;
                   } else {
                       $easy_discount->clear('DS_CTTL');
                   }
                   break;

                case TEXT_COUPON_CONDITION_CART_QTY:
                   if ($comparison) 
                   {
                       $easy_discount->set('DS_CQTY',$ds['special_name'],$amt);
                       $dsClear = false;
                   } else {
                       $easy_discount->clear('DS_CQTY');
                   }
                   break;  

and replace with

   echo 'cmp '.$comparison.'<br>';
             switch ($ds['condition1'])
             {
                case TEXT_COUPON_CONDITION_CART_TOTAL:
                   if ($comparison) 
                   {
                       $easy_discount->set('DS_CTTL',$ds['special_name'], $amt);
                      echo 'TTL '. print_r($easy_discount->get_all()).'<br>';
                       $dsClear = false;
                   } else {
                       $easy_discount->clear('DS_CTTL');
                   }
                   break;

                case TEXT_COUPON_CONDITION_CART_QTY:
                   if ($comparison) 
                   {
                      echo 'QTY '. print_r($easy_discount->get_all()).'<br>';
                       $easy_discount->set('DS_CQTY',$ds['special_name'],$amt);
                       $dsClear = false;
                   } else {
                       $easy_discount->clear('DS_CQTY');
                   }
                   break;
                default:  echo 'def - no condition -> '. $ds['condition1'].'<br>';  

Share this post


Link to post
Share on other sites

OK. This is the last, last change. :) In that same file, find this

              switch ($ds['condition1'])
             {
                case TEXT_COUPON_CONDITION_CART_TOTAL:
                   if ($comparison) 
                   {
                       $easy_discount->set('DS_CTTL',$ds['special_name'], $amt);
                       $dsClear = false;
                   } else {
                       $easy_discount->clear('DS_CTTL');
                   }
                   break;

                case TEXT_COUPON_CONDITION_CART_QTY:
                   if ($comparison) 
                   {
                       $easy_discount->set('DS_CQTY',$ds['special_name'],$amt);
                       $dsClear = false;
                   } else {
                       $easy_discount->clear('DS_CQTY');
                   }
                   break;  

and replace with

   echo 'cmp '.$comparison.'<br>';
             switch ($ds['condition1'])
             {
                case TEXT_COUPON_CONDITION_CART_TOTAL:
                   if ($comparison) 
                   {
                       $easy_discount->set('DS_CTTL',$ds['special_name'], $amt);
                      echo 'TTL '. print_r($easy_discount->get_all()).'<br>';
                       $dsClear = false;
                   } else {
                       $easy_discount->clear('DS_CTTL');
                   }
                   break;

                case TEXT_COUPON_CONDITION_CART_QTY:
                   if ($comparison) 
                   {
                      echo 'QTY '. print_r($easy_discount->get_all()).'<br>';
                       $easy_discount->set('DS_CQTY',$ds['special_name'],$amt);
                       $dsClear = false;
                   } else {
                       $easy_discount->clear('DS_CQTY');
                   }
                   break;
                default:  echo 'def - no condition -> '. $ds['condition1'].'<br>';  

 

 

Thank you very much.

here is the output:

 

cmp 1
def - no condition -> Cart Quantity

Share this post


Link to post
Share on other sites

Thank you very much.

here is the output:

 

cmp 1
def - no condition -> Cart Quantity

OK. After all of that, the problem is that your shop side cannot see the definitons. Be sure you have made the required changes to includes/lanugages/english.php.

Share this post


Link to post
Share on other sites

OK. After all of that, the problem is that your shop side cannot see the definitons. Be sure you have made the required changes to includes/lanugages/english.php.

 

believe me this contrib is perfectly installed. All changes from the Manual are made.

When i comment out the following lines in eg shopping_cart.php

 /*** Begin Daily Specials ***/
     //if ($easy_discount->count() > 0) {
       echo '<tr><td align="right"><table border="0" cellpadding="0">';
       echo easy_discount_display();
       echo '</table></td></tr>';
       echo '<tr><td align="right"><table border="0" cellpadding="0">';
       echo '<tr><td class="main" align="right"><b>'.SUB_TITLE_TOTAL.'</b></td><td class="main" align="right">'.$currencies->format(($cart->show_total() - $easy_discount->total())).'</td></tr>';
       echo '</table></td></tr>';
     //}
     /*** End Daily Specials ***/

 

The defines are visible but no discount. :blink:

Share this post


Link to post
Share on other sites

The defines are visible but no discount. :blink:

I don't have an answer for you then. They are not being seen in your shop so there is something wrong somewhere in your code. Trying to trace that here is out of the scope of support for a thread like this.

Share this post


Link to post
Share on other sites

I don't have an answer for you then. They are not being seen in your shop so there is something wrong somewhere in your code. Trying to trace that here is out of the scope of support for a thread like this.

Ok, thanks for your patience!

 

I'll try my best to find the bug!

If i find an answer i will post it here!

Share this post


Link to post
Share on other sites

What happens if you try some other condition, like quantity > 1? Do you have a category or product set in the special?

Yep! That was it!! Thanks for all you do! I have a lot of your contributions installed and they all are work wonders!!!

Share this post


Link to post
Share on other sites

Sorry! just posted to the wrong area...my bad!! On more question for you..I'm having a issues with the banner not showing up when you first load the site. If you refresh the browser in IE or reload in Firefox 5 times or so the banner loads...I'm using STS....Thanks again..Every thing does work when the banner appears..

Share this post


Link to post
Share on other sites

I don't have an answer for you then. They are not being seen in your shop so there is something wrong somewhere in your code. Trying to trace that here is out of the scope of support for a thread like this.

 

 

I have finally found the bug! :rolleyes:

In my header.php I've integrated a mootools banner script which prevents your script to work properly.

After changing the sort order of display everything works like a charm!

 

Thank you for this very useful contrib and your friendly support

 

Harry

Share this post


Link to post
Share on other sites

I have finally found the bug! :rolleyes:

In my header.php I've integrated a mootools banner script which prevents your script to work properly.

After changing the sort order of display everything works like a charm!

 

Thank you for this very useful contrib and your friendly support

 

Harry

I apologize to bother you again but there is another Problem.

I got two languages installed, but the specials only work for english not for german.

Whether by defining the special to "All" languages or only "german".

 

Any suggestions?

Thank you in advance

Share this post


Link to post
Share on other sites

Sorry! just posted to the wrong area...my bad!! On more question for you..I'm having a issues with the banner not showing up when you first load the site. If you refresh the browser in IE or reload in Firefox 5 times or so the banner loads...I'm using STS....Thanks again..Every thing does work when the banner appears..

The only thing I can think of that might cause that is if you have another banner in test mode. That banner won't show but it will take up a place in the rotation so none would show when it is reached. Be sure the ending dates of all banners you don't want to show are past dates. Other than that, I don't have any other ideas.

Share this post


Link to post
Share on other sites

I got two languages installed, but the specials only work for english not for german.

Whether by defining the special to "All" languages or only "german".

No, I don't. It works fine in shops I've installed it in that have more than one language.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×