Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2008
    Posts
    35
    Plugin Contributions
    0

    Default Better Together mod

    When using the "Better Together" mod it only shows the discount linking as text, is there a way to add a thumbnail?

    example:

    Buy this item and get "some product " <thumbnail pic here> for 50% off.

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,684
    Plugin Contributions
    123

    Default Re: Better Together mod

    I am planning on adding capabilities like this in a future release.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Jun 2008
    Posts
    35
    Plugin Contributions
    0

    Default Re: Better Together mod

    Code:
    // call this in product info page
        function get_discount_info($id, $cat) { 
           global $order, $currencies;
           $response_arr = array(); 
    
           for ($dis=0, $n=count($this->twoferlist); $dis<$n; $dis++) {
               $li = $this->twoferlist[$dis]; 
               $match = 0;
               if ( ($li->flavor == TWOFER_PROD) && 
                    ($li->ident1 == $id)  ) {
                  $match = 1; 
                  if ($this->nocontext == 0) {
                     $disc_string = TWOFER_PROMO_STRING; 
                  } else {
                     $disc_link = '<a href="'.zen_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $li->ident1).'">'. zen_get_products_name($li->ident1, $_SESSION['languages_id']).'</a>';
                     $disc_string = QUALIFY; 
                     $disc_string .= GET_THIS; 
                     $disc_string .= SECOND; 
                     $disc_string .= $disc_link;
                     $disc_string .= FREE;
                  }
               } else if ( ($li->flavor == TWOFER_CAT) && 
                           ($li->ident1 == $cat) ) {
                  $match = 1; 
                  if ($this->nocontext == 0) {
                     $disc_string = TWOFER_CAT_PROMO_STRING; 
                  } else {
                     $disc_link = '<a href="'.zen_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $id).'">'. zen_get_products_name($id, $_SESSION['languages_id']).'</a>';
                     $disc_string = QUALIFY; 
                     $disc_string .= GET_THIS; 
                     $disc_string .= SECOND; 
                     $disc_string .= $disc_link;
                     $disc_string .= FREE;
                  }
               }
               if ($match == 1) {
                  $response_arr[] = $disc_string;
                  continue;
               }
           }
    
           for ($dis=0, $n=count($this->discountlist); $dis<$n; $dis++) {
               $li = $this->discountlist[$dis]; 
               $match = 0; 
               if ( ($li->flavor == PROD_TO_PROD) &&
                    ($li->ident1 == $id) ) {
                  $match = 1; 
                  $disc_link = '<a href="'.zen_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $li->ident2).'">'. zen_get_products_name($li->ident2, $_SESSION['languages_id']).'</a>';
    //////////////////////////////////////////////////////////////////////Added by Me///////////////////////////////////////////////////////////////////////////////			  		  
    			    $disc_prod_image_id = $li->ident2;
    			  	$result = mysql_query("SELECT * FROM products WHERE products_id='$disc_prod_image_id'");
    			  	while($row = mysql_fetch_array($result))
    			  	{
      					$show_image = $row['products_image'];
      					echo "<br />";
    					echo zen_image(DIR_WS_IMAGES . $show_image, $category_icon_display_name, CATEGORY_ICON_IMAGE_WIDTH, CATEGORY_ICON_IMAGE_HEIGHT);
     			    }
    /////////////////////////////////////////////////////////////////// End Added by Me//////////////////////////////////////////////////////////////////////////				
               } else if ( ($li->flavor == PROD_TO_CAT) &&
                    ($li->ident1 == $id) ) {
                  $match = 1; 
                  $disc_link = '<a href="'.zen_href_link(FILENAME_DEFAULT, 'cPath=' . $li->ident2).'">'. zen_get_category_name($li->ident2, $_SESSION['languages_id']).'</a>';
               } else if ( ($li->flavor == CAT_TO_CAT) &&
                    ($li->ident1 == $cat) ) {
                  $match = 1; 
                  $disc_link = '<a href="'.zen_href_link(FILENAME_DEFAULT, 'cPath=' . $li->ident2).'">'. zen_get_category_name($li->ident2, $_SESSION['languages_id']).'</a>';
               }
               if ($match == 1) {
                  if ($this->nocontext == 0)  
                     $disc_string = BUY_THIS_ITEM; 
                  else 
                     $disc_string = QUALIFY; 
                  if ($li->flavor == PROD_TO_PROD) {
                      $disc_string .= GET_THIS; 
                  } else {
                      $disc_string .= GET_ANY; 
                  } 
                  if ( ($li->flavor == PROD_TO_PROD)  &&
                       ($li->ident1 == $li->ident2) && 
                       ($this->nocontext == 0) ) {
                         $disc_string .= SECOND_ONE;
                  } else { 
                      $disc_string .= $disc_link; 
                  }
                  $disc_string .= " "; 
                  if ($li->type == "%") {
                     if ($li->amt != 100) {
                        $str_amt = $li->amt . "%"; 
                        $off_string = sprintf(OFF_STRING_PCT, $str_amt);
                     } else {
                        $off_string = FREE_STRING;
                     }
                     $disc_string .= $off_string;
                  } else {
                     $curr_string = $currencies->format($li->amt, true, $order->info['currency'], $order->info['currency_value']);
                     $off_string = sprintf(OFF_STRING_CURR, $curr_string); 
                     $disc_string .= $off_string;
                  }
                  $response_arr[] = $disc_string;
               }
           }
           return $response_arr;
        }
    
        // call this in product info page to show what to do to get a 
        // discount (the opposite way.)
        function get_reverse_discount_info($id, $cat) { 
           global $order, $currencies;
           $response_arr = array(); 
    
           for ($dis=0, $n=count($this->discountlist); $dis<$n; $dis++) {
               $li = $this->discountlist[$dis]; 
               $match = 0; 
               if ($li->ident2 == $li->ident1) {
                   continue;
               }
               $this_string = REV_GET_DISC; 
               if ( ($li->flavor == PROD_TO_PROD) &&
                    ($li->ident2 == $id) ) {
                  $match = 1; 
                  $disc_link = '<a href="'.zen_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $li->ident1).'">'. zen_get_products_name($li->ident1, $_SESSION['languages_id']).'</a>';
    //////////////////////////////////////////////////Added by Me//////////////////////////////////////////////////////////			  
    			  $disc_prod_image_id = $li->ident1;
    			  $result = mysql_query("SELECT * FROM products WHERE products_id='$disc_prod_image_id'");
    			  while($row = mysql_fetch_array($result))
    			  	{
      					$show_image = $row['products_image'];
      					echo "<br />";
    					echo zen_image(DIR_WS_IMAGES . $show_image, $category_icon_display_name, CATEGORY_ICON_IMAGE_WIDTH, CATEGORY_ICON_IMAGE_HEIGHT);
     			    }
    //////////////////////////////////////////////////////End Added by Me/////////////////////////////////////////////////////////				
                  if ($this->nocontext == 1) { 
                       $this_string = GET_YOUR_PROD . zen_get_products_name($li->ident2, $_SESSION['languages_id']); 
                  }
               } else if ( ($li->flavor == PROD_TO_CAT) &&
                    ($li->ident2 == $cat) ) {
                  $match = 1; 
                  $disc_link = '<a href="'.zen_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $li->ident1).'">'. zen_get_products_name($li->ident1, $_SESSION['languages_id']).'</a>';
                  if ($this->nocontext == 1) { 
                       $this_string = GET_YOUR_CAT . zen_get_category_name($li->ident2, $_SESSION['languages_id']); 
                  }
               } else if ( ($li->flavor == CAT_TO_CAT) &&
                    ($li->ident2 == $cat) ) {
                  $match = 1; 
                  $disc_link = '<a href="'.zen_href_link(FILENAME_DEFAULT, 'cPath=' . $li->ident1).'">'. zen_get_category_name($li->ident1, $_SESSION['languages_id']).'</a>';
                  if ($this->nocontext == 1) { 
                       $this_string = GET_YOUR_CAT . zen_get_category_name($li->ident2, $_SESSION['languages_id']); 
                  }
               }
               if ($match == 1) {
                  if ( ($li->flavor == PROD_TO_PROD) || 
                       ($li->flavor == PROD_TO_CAT) )  {
                      $disc_string = REV_GET_THIS; 
                  } else {
                      $disc_string = REV_GET_ANY; 
                  } 
                  $disc_string .= $disc_link; 
                  $disc_string .= $this_string; 
                  if ($li->type == "%") {
                     if ($li->amt != 100) {
                        $str_amt = $li->amt . "%"; 
                        $off_string = sprintf(OFF_STRING_PCT, $str_amt);
                     } else {
                        $off_string = FREE_STRING;
                     }
                     $disc_string .= $off_string;
                  } else {
                     $curr_string = $currencies->format($li->amt, true, $order->info['currency'], $order->info['currency_value']);
                     $off_string = sprintf(OFF_STRING_CURR, $curr_string); 
                     $disc_string .= $off_string;
                  }
                  $response_arr[] = $disc_string;
               }
           }
           return $response_arr;
        }

  4. #4
    Join Date
    Jun 2008
    Posts
    35
    Plugin Contributions
    0

    Default Re: Better Together mod

    The code will use the same image used for the product listing thubnail.

  5. #5
    Join Date
    Jun 2008
    Posts
    35
    Plugin Contributions
    0

    Default Re: Better Together mod

    sorry, in the line.
    echo zen_image(DIR_WS_IMAGES . $show_image, $category_icon_display_name, CATEGORY_ICON_IMAGE_WIDTH, CATEGORY_ICON_IMAGE_HEIGHT)

    This can be removed it does not do anything. Do be sure to keep the ) at the end.
    , CATEGORY_ICON_IMAGE_WIDTH, CATEGORY_ICON_IMAGE_HEIGHT

  6. #6
    Join Date
    May 2005
    Location
    England
    Posts
    626
    Plugin Contributions
    0

    Default Re: Better Together mod

    Hello Coolman,

    This is a great idea. I got an error when I tried it, but I think it might be because I am on php 5.

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/thegemtr/public_html/includes/modules/order_total/ot_better_together.php on line 474
    Heathenmagic

 

 

Similar Threads

  1. Better Together Centerbox
    By swguy in forum All Other Contributions/Addons
    Replies: 8
    Last Post: 27 Nov 2011, 06:21 PM
  2. Better Together add-on
    By CaroleAs in forum All Other Contributions/Addons
    Replies: 16
    Last Post: 2 Nov 2010, 04:31 PM
  3. Question about Better Together mod by swguy
    By giftmeister in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 12 Feb 2009, 02:52 AM
  4. Better together mod
    By coolman in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 16 Aug 2008, 09:48 PM
  5. Better together problem
    By JasonRSI in forum Addon Payment Modules
    Replies: 2
    Last Post: 27 Nov 2007, 06:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR