Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dangling Carrot (Free Gift/Discount Contrib)


thejungle

Recommended Posts

Bah! Found some more issues. Hold up on downloading the latest package until I upload the newest version later tonight (Pacific Time).

 

Theres just so many different combinations that it is hard to test and check for everything.

Link to comment
Share on other sites

  • Replies 308
  • Created
  • Last Reply

Top Posters In This Topic

Bah! Found some more issues. Hold up on downloading the latest package until I upload the newest version later tonight (Pacific Time).

 

Theres just so many different combinations that it is hard to test and check for everything.

 

 

Hi,

I am need of this. I have a sale and deal with a free gist going on and need to be able to use this. Do you have a new package yet?

 

Thanks,

Philip

Link to comment
Share on other sites

also , i made a product inactive , when i clicked on the , well what should be buy button , see above post, i get page showing the product , but it isnr added to the cart

 

this doesnt happen if the product is active , it works as expected

 

looking at the code, there are two lines for the image

 

//$freebie[$p]['link'] = '<a href="index.php?action=buy_now&products_id='.$gift['products_id'].'"><img src="images/button_select_now.gif" border="0"></a>';

  $freebie[$p]['link'] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $gift['products_id']) . '">' . tep_image_button('button_select_now_b_s.gif', 'Select ' . $gift['products_id'] . TEXT_NOW) . '</a>';

 

you might notice that the image name in the code not commented out (in bold) is not even named the same as the original code or the actual file... change button_select_now_b_s.gif to button_select_now.gif...

Edited by msdesmarais

Michael

Link to comment
Share on other sites

Michaael,

 

The gift does not necessarily have to be $0.00. It could be a half price gift or 99 cents offer so you can set it to anything. Generally they are 0 if it is a free gift.

 

I will post back in a bit with the new changes.

Link to comment
Share on other sites

Ok version 1.3 added.

 

There is only 1 bug left that I have been able to find. Read the info on the contribution page. It is a simple fix to solve that problem and as soon as I get around to it I will upload a new file.

Link to comment
Share on other sites

Ok version 1.3 added.

 

There is only 1 bug left that I have been able to find. Read the info on the contribution page. It is a simple fix to solve that problem and as soon as I get around to it I will upload a new file.

 

 

Hi,

I have a problem. I get an error on the shopping_cart.php page.

 

Also in the new instructions - there is Step 3 - and it does not say what file to change.?

 

 

Thanks,

Philip

Link to comment
Share on other sites

sorry. step 3 is in catalog/includes/boxes/shopping_cart.php

 

What is the error? How can we know how to help you if you do not post the error.

 

 

Sorry, the error is: Parse error: parse error in /I changed the path here/store/shopping_cart.php on line 365

 

Here is the code for the shopping_cart.php file:

<?php
/*
 $Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require("includes/application_top.php");

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));

//BOF dangling carrot v1.3





if ($cart->count_contents() > 0){



   // find any free gifts, and remove invalid ones



   $num_in_cart = $cart->show_total();



   $products = $cart->get_products();

 

$gift_query = tep_db_query("SELECT fg.*, p.products_id, p.products_model, p.products_price, p.products_image, pd.products_name FROM free_gifts fg, products p

LEFT JOIN products_description pd ON (pd.products_id=fg.products_id)

WHERE pd.language_id = '".$languages_id."'

AND p.products_id = fg.products_id

ORDER BY fg.threshold ASC");



$threshold = 0;

$p=0;

$gift_price=0;

$gift_exists=0;



while ($gift = tep_db_fetch_array($gift_query)) {

 // loop through the current gifts

 



 if ($gift_exists == 0){

	 for ($i=0, $n=sizeof($products); $i<$n; $i++) {

   if ($products[$i]['id'] == $gift['products_id']) {

  	 // gift already in cart

  	 $gift_exists = $products[$i]['id'];

  	 $gift_price = $gift['products_price'];

  	 $deficit = $gift['threshold'] - $num_in_cart + $gift_price;

  	 break;

   } else {

  	 

  	 $deficit = $gift['threshold'] - $num_in_cart;

  	 

   }



 }

	 

 

 }



 else {

	 

	 

	 $deficit = $gift['threshold'] - $num_in_cart + $gift_price;	

 }

 

 

if (  $deficit < 20 && $deficit > 0 ) {

	 $near_limit = 1;

 } else {

	 $near_limit = 0;

 }

 



 

 if ($num_in_cart >= $gift['threshold'] && $deficit <= 0) {

	 // cart could qualify for this gift

     

	 // check to see if in cart already

	 // add to gift list if not in cart

 



	 if ($gift['products_id'] != $gift_exists && $deficit <= 0) {

   // this particular gift is not in cart but qualifies

   

   $freebie[$p]['message'] .= 'By spending over '.$currencies->display_price($gift['threshold'],tep_get_tax_rate($gift['products_tax_class_id'])).' you have qualified for the following gift!';

   //$freebie[$p]['link'] = '<a href="index.php?action=buy_now&products_id='.$gift['products_id'].'"><img src="images/button_select_now.gif" border="0"></a>';

   $freebie[$p]['link'] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $gift['products_id']) . '">' . tep_image_button('button_select_now.gif', 'Select ' . $gift['products_id'] . TEXT_NOW) . '</a>';

   $freebie[$p]['name']      = $gift['products_name'];

   $freebie[$p]['id']        = $gift['products_id'];

   $freebie[$p]['image']   	 = $gift['products_image'];

   //$freebie[$p]['price']   	 = $gift['products_trade_price'];

   

   $p++;

	 }

	 

 } 

 else if ($near_limit) {

	 if ($gift['products_id'] != $gift_exists) {

   // this particular gift is not in cart





   $freebie[$p]['message'] .= '<font color="red">Spend just '. $currencies->display_price($deficit,tep_get_tax_rate($gift['products_tax_class_id'])).' more to get ...</font>';

   $freebie[$p]['link'] = '';

   $freebie[$p]['name']      = $gift['products_name'];

   $freebie[$p]['id']        = $gift['products_id'];

   $freebie[$p]['image']   	 = $gift['products_image'];

   //$freebie[$p]['price']   	 = $gift['products_trade_price'];

   

   $p++;

	 } else {

	 // cart cannot qualify for this gift

	 // remove if in cart

   

	 //  $gift_message .= '<br><font color="red">The gift <i>'. $gift['products_name'] . '</i> is not allowed for orders under ' . $gift['threshold'] .'. It has been removed from your cart.</font>';

	 $cart->remove($gift['products_id']);

	 

	 }







 } else {

	 // cart cannot qualify for this gift

	 // remove if in cart

   

//  $gift_message .= '<br><font color="red">The gift <i>'. $gift['products_name'] . '</i> is not allowed for orders under ' . $gift['threshold'] .'. It has been removed from your cart.</font>';

	 $cart->remove($gift['products_id']);



 }

 $threshold = $gift['threshold'];

}//while







}



 //EOF dangling carrot v1.3

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<div align="center">
 <table width="<?php echo PAGE_WIDTH; ?>" border="0" cellpadding="0" cellspacing="0" bgcolor="<?php echo PAGE_BG_COLOR; ?>">
   <tr>
     <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
 <!-- left_navigation //-->
 <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
 <!-- left_navigation_eof //-->
     </table></td>
 <!-- body_text //-->
     <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
       <tr>
         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
           <tr>
             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
             <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_cart.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
           </tr>
         </table></td>
       </tr>
       <tr>
         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
       </tr>
 <?php
 if ($cart->count_contents() > 0) {
?>
       <tr>
         <td>
 <?php
   $info_box_contents = array();
   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_REMOVE);

   $info_box_contents[0][] = array('params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_PRODUCTS);

   $info_box_contents[0][] = array('align' => 'center',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_QUANTITY);

   $info_box_contents[0][] = array('align' => 'right',
                                   'params' => 'class="productListing-heading"',
                                   'text' => TABLE_HEADING_TOTAL);

   $any_out_of_stock = 0;
   $products = $cart->get_products();
   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// Push all attributes information in an array
     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
       while (list($option, $value) = each($products[$i]['attributes'])) {
//          echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                     where pa.products_id = '" . $products[$i]['id'] . "'
                                      and pa.options_id = '" . $option . "'
                                      and pa.options_id = popt.products_options_id
                                      and pa.options_values_id = '" . $value . "'
                                      and pa.options_values_id = poval.products_options_values_id
                                      and popt.language_id = '" . $languages_id . "'
                                      and poval.language_id = '" . $languages_id . "'");
         $attributes_values = tep_db_fetch_array($attributes);

         //clr 030714 determine if attribute is a text attribute and assign to $attr_value temporarily
         if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
           echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']',  $products[$i]['attributes_values'][$option]);
           $attr_value = $products[$i]['attributes_values'][$option];
         } else {
           echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
           $attr_value = $attributes_values['products_options_values_name'];
         }

         $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
         $products[$i][$option]['options_values_id'] = $value;

//          $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];

         $products[$i][$option]['products_options_values_name'] = $attr_value;

         $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
         $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
       }
     }
   }

   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
     if (($i/2) == floor($i/2)) {
       $info_box_contents[] = array('params' => 'class="productListing-even"');
     } else {
       $info_box_contents[] = array('params' => 'class="productListing-odd"');
     }

     $cur_row = sizeof($info_box_contents) - 1;

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

     $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
                      '  <tr>' .
                      '    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
                      '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';

<!--BOF dangling carrot v1.3--> 



if ($products[$i]['model'] == "gift"){

    	 $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .

 '  <tr>' .

 '    <td class="productListing-data" align="center">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</td>' .

 '    <td class="productListing-data" valign="top"><b>' . $products[$i]['name'] . '</b>';

}

else{

 $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .

             '  <tr>' .

             '    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .

             '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';



}



<!--EOF dangling carrot v1.3-->

     if (STOCK_CHECK == 'true') {
       $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
       if (tep_not_null($stock_check)) {
         $any_out_of_stock = 1;

         $products_name .= $stock_check;
       }
     }

     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
       reset($products[$i]['attributes']);
       while (list($option, $value) = each($products[$i]['attributes'])) {
         $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
       }
     }

     $products_name .= '    </td>' .
                       '  </tr>' .
                       '</table>';

     $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
                                            'text' => $products_name);

//      $info_box_contents[$cur_row][] = array('align' => 'center',
//                                             'params' => 'class="productListing-data" valign="top"',
//                                             'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

<!--BOF dangling carrot v1.3--> 



if ($products[$i]['model'] == "gift"){

             $info_box_contents[$cur_row][] = array('align' => 'center',

                                               'params' => 'class="productListing-data" valign="top"',

                                               'text' => $products[$i]['quantity']. tep_draw_hidden_field('products_id[]', $products[$i]['id']));

}

     else

     {

        $info_box_contents[$cur_row][] = array('align' => 'center',

                                               'params' => 'class="productListing-data" valign="top"',

                                               'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

     }





<!--EOF dangling carrot v1.3-->

     $info_box_contents[$cur_row][] = array('align' => 'right',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
   }

   new productListingBox($info_box_contents);
?>
         </td>
       </tr>
       <tr>
         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
       </tr>
       <tr>
         <td align="right" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td>
       </tr>
 <?php
   if ($any_out_of_stock == 1) {
     if (STOCK_ALLOW_CHECKOUT == 'true') {
?>
       <tr>
         <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td>
       </tr>
 <?php
     } else {
?>
       <tr>
         <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td>
       </tr>
 <?php
     }
   }
?>
       <tr>
         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
       </tr>
       <tr>
         <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
           <tr class="infoBoxContents">
             <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
               <tr>
                 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                 <td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>
 <?php
   $back = sizeof($navigation->path)-2;
   if (isset($navigation->path[$back])) {
?>
                 <td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>
 <?php
   }
?>
                 <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
                 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               </tr>
             </table></td>
           </tr>
         </table></td>
       </tr>

<!--BOF dangling carrot v1.3-->

<?php

if ($cart->count_contents() > 0){

?>

 <tr><td>

           <hr noshade width="100%" size="1">

           <?php 

 

 if ($gift_message) {

	 echo '<div align="center"><span class="smallText">'.$gift_message.'</span></div><p>';

 }

 

 for ($i=0, $n=sizeof($freebie); $i<$n; $i++) {

	 if ($gift_exists > 0) {

   $link = '<font color="red">Please remove other gifts/offers from your cart first</font>';

	 } else {

   $link = $freebie[$i]['link'];

	 }

	 echo '<table width="100%" align="center" cellspacing="1" bgcolor="#FFFFFF">

	 <tr>

   <td class="smallText" bgcolor="#FFFFFF">

   <img src="'.DIR_WS_IMAGES.'/'.$freebie[$i]['image'].'" align="left">

   '.$freebie[$i]['message'].'

   <br><b>'.$freebie[$i]['name'].'</b>

   <br>'.$link.'

   <br>(Maximum 1 gift per order)

   </td>

	 </tr>

	 </table>';

     

 }

 

 if ($freebie[0]['name']) {

	 echo '<hr noshade width="100%" size="1">';

 }



 

 ?>

 </td></tr>

 

<?php

}

?>





<!--EOF dangling carrot v1.3-->

 <?php
 } else {
?>
       <tr>
         <td align="center" class="main"><?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?></td>
       </tr>
       <tr>
         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
       </tr>
       <tr>
         <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
           <tr class="infoBoxContents">
             <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
               <tr>
                 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                 <td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                 <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               </tr>
             </table></td>
           </tr>
         </table></td>
       </tr>
 <?php
 }
?>
     </table></form></td>
 <!-- body_text_eof //-->
     <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
 <!-- right_navigation //-->
 <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
 <!-- right_navigation_eof //-->
     </table></td>
   </tr>
 </table>
 <!-- body_eof //-->
 
<!-- footer //-->
 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 <!-- footer_eof //-->
 <br>
</div>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

:D

Dear sir,

This was a very good CONTRIBUTION,I already installed to my osc and worked very fine.

 

Sir,thank you very much,this CONTRIBUTION let my shopping become more popular.

 

Sir,can you teach me how to show the gifts on column_right,or can you tell me if any CONTRIBUTION can do this,

 

Thank you very much

 

richard

Link to comment
Share on other sites

I am having a problem similar to one discussed earlier. I cannot add the qualifying gift unless the gift is active or in stock. When active it works fine but also shows in the store with a price of $0.00. It appears that the cart is checking the availability of the items before updating the cart. The item is inserted into the customer_basket table but is not being rendered by the shopping_cart.php. I am using oscdox's osC-MAX 1.7 with BTS 1.2. I've made all the necessary translations to the BTS code and like I stated earlier works great when the product is active.

 

Any ideas of where to check for the stock check?

Link to comment
Share on other sites

hmm, not sure what it could be as that line 365 is unaffected by this contribution. i would have to say upload your backup file and try it again.

 

 

I tried uploading a new clean file for the shopping_cart.php - then I added the code and it gives me an error still get an error.

          $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
         $products[$i][$option]['options_values_id'] = $value;
         $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
         $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
         $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
       }
     }
   }

   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
     if (($i/2) == floor($i/2)) {
       $info_box_contents[] = array('params' => 'class="productListing-even"');
     } else {
       $info_box_contents[] = array('params' => 'class="productListing-odd"');
     }

     $cur_row = sizeof($info_box_contents) - 1;

     $info_box_contents[$cur_row][] = array('align' => 'center',
                                            'params' => 'class="productListing-data" valign="top"',
                                            'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']));

 

the error is for the line that has

      } else {

 

This only happens when I install this contrib. Others work find.

 

Maybe you could send me a copy of the shopping_cart.php file you have?

 

Thanks,

Philip

Edited by dwdonline
Link to comment
Share on other sites

Philip,

 

my file will be very different than yours. I was looking through your shopping_cart.php file posted on the previous page:

 

lines 374-377 should have been *replaced* by 379-411. You just added the new lines after, which is incorrect.

 

Not sure if that will make a difference. Try it out first and then let us know.

Link to comment
Share on other sites

Philip,

 

my file will be very different than yours. I was looking through your shopping_cart.php file posted on the previous page:

 

lines 374-377 should have been *replaced* by 379-411.  You just added the new lines after, which is incorrect.

 

Not sure if that will make a difference. Try it out first and then let us know.

 

Hi,

I did that and now I get this: Parse error: parse error in /............/store/shopping_cart.php on line 349.

 

Here are lines 340 - 356.

 

         if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
          echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']',  $products[$i]['attributes_values'][$option]);
          $attr_value = $products[$i]['attributes_values'][$option];
        } else {
          echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
          $attr_value = $attributes_values['products_options_values_name'];
        }

        $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
        $products[$i][$option]['options_values_id'] = $value;
        $products[$i][$option]['products_options_values_name'] = $attr_value;

        $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
        $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
      }
    }
  }

Link to comment
Share on other sites

I am having a problem similar to one discussed earlier.  I cannot add the qualifying gift unless the gift is active or in stock.  When active it works fine but also shows in the store with a price of $0.00.  It appears that the cart is checking the availability of the items before updating the cart.  The item is inserted into the customer_basket table but is not being rendered by the shopping_cart.php.  I am using oscdox's osC-MAX 1.7  with BTS 1.2.  I've made all the necessary translations to the BTS code and like I stated earlier works great when the product is active. 

 

Any ideas of where to check for the stock check?

Solved my own problem. I have the Price Break per product Mod and it uses a PriceFormatter.php function called from get_products() to query the product list and format prices. The products query included a WHERE clause that excluded the products_status='0'. I modified it to do a join on the free_gifts table and see if the product existed. Everything is working fine now.

Link to comment
Share on other sites

  • 2 weeks later...

HI!

 

I just wanted to say thank you for this wonderful contribution, I just got it working on creloaded 6.1a with a little tweaking. There is a thread on the cre site http://www.creloaded.com/Forums/viewtopic/p=21279.html#21279 that might help people who want to add this contribution to that version.

 

Thanks again, this is a great addition.

Link to comment
Share on other sites

Just loaded the new version and everything appears to be working but the button_select.gif button does not appear. Just the text message and the product picuture. So I am unable to add the gift to my shopping cart.

 

Any ideas on where I can look?

 

 

this is the only text that shows:

 

By spending over $25.00 you have qualified for the following gift!

12" Inflate-A-Globe

 

(Maximum 1 gift per order)

Link to comment
Share on other sites

Just loaded the new version and everything appears to be working but the button_select.gif button does not appear.  Just the text message and the product picuture.  So I am unable to add the gift to my shopping cart.

 

Any ideas on where I can look?

this is the only text that shows:

 

By spending over $25.00 you have qualified for the following gift!

12" Inflate-A-Globe

 

(Maximum 1 gift per order)

 

 

More INFO:

 

Here is my shopping_cart. If I unremark out the //$freebie line I receive the select button but I do not want to do that.

 

if ($gift['products_id'] != $gift_exists && $deficit <= 0) {
   // this particular gift is not in cart but qualifies
   
   $freebie[$p]['message'] .= 'By spending over '.$currencies->display_price($gift['threshold'],tep_get_tax_rate($gift['products_tax_class_id'])).' you have qualified for the following gift!';
   //$freebie[$p]['link'] = '<a href="index.php?action=buy_now&products_id='.$gift['products_id'].'"><img src="images/button_select_now.gif" border="0"></a>';
   $freebie[$p]['link'] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $gift['products_id']) . '">' . tep_image_button('button_select_now.gif', 'Select ' . $gift['products_id'] . TEXT_NOW) . '</a>';
   $freebie[$p]['name']      = $gift['products_name'];
   $freebie[$p]['id']        = $gift['products_id'];
   $freebie[$p]['image']   	 = $gift['products_image'];
   //$freebie[$p]['price']   	 = $gift['products_trade_price'];
   
   $p++;

Link to comment
Share on other sites

I just uploaded a new version. Here are the changes I made:

 

- Changed image display code to use alt text and database image size settings

- Added image size settings to admin

- Added drop down for gifts in admin

- Cleaned up form in admin

- Cleaned up instructions

 

Note that to use the image size settings, the database will have to be updated. I didn't think to put an update script in the archive. The two lines needed for the update can just be copied and pasted in phpmyadmin but if it is a problem, I can add an update.sql file.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...