Results 1 to 10 of 699

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Cuero, TX
    Posts
    55
    Plugin Contributions
    0

    Default Re: Better Together Contribution Support Thread

    Greetings swguy, thanks for sticking with me today. Weird, but the missing emails showed up this evening. Anyway, I have installed:

    • better_2.3b
    • bt_admin_3.1
    • bt_admin_xajax
    • candy_1.3.9_5
    • center_better_1.0a
    • marketing
    • preview_1.3.9_8_subtotal
    • promo_better_2.2a


    Everything is up and running without any hassle and I have very little experience working with this type of customization. Well done on your part!

    The only question I have is the "Better Together" display on the product_display_page. On my site, it is just a simple line of text with the correct linked information but what needs to be done (or what might I have missed) to get it "boxed" so that it stands out as in your example? I would prefer it to look like the example you gave with the field set.



    Any help you or anyone else can offer would be appreciated.

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,536
    Plugin Contributions
    127

    Default Re: Better Together Contribution Support Thread

    Quote Originally Posted by Ranch Dog View Post
    On my site, it is just a simple line of text with the correct linked information but what needs to be done (or what might I have missed) to get it "boxed" so that it stands out as in your example? I would prefer it to look like the example you gave with the field set.


    Modify includes/templates/YOUR_TEMPLATE/templates/tpl_better_together_marketing.php.

    Above

    echo '<div class="content" id="betterTogetherDiscountPolicy">';

    add
    echo '<fieldset>';
    echo '<legend>' . MODULE_ORDER_TOTAL_BETTER_TOGETHER_TITLE . '</legend>';

    then below

    echo '</div>';

    add

    echo '</fieldset>';
    That Software Guy. My Store: Zen Cart Support
    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
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,536
    Plugin Contributions
    127

    Default Re: Better Together Contribution Support Thread

    BTW, thanks for your kind words.

    I also updated the help page with these instructions.
    That Software Guy. My Store: Zen Cart Support
    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.

  4. #4
    Join Date
    Aug 2010
    Location
    Cuero, TX
    Posts
    55
    Plugin Contributions
    0

    Default Re: Better Together Contribution Support Thread

    Thanks! Looks very nice on the product page plus with the "Candy" package, I should be able to get some stale inventory moving!

    This Zen-challenged fellow found all the different modules that I installed very easy, even the file merge with candy/discount preview. Now, I might redo my products so that their attributes make them individual products then I could use the "Buy Now" button options you offer. A lot of people use the quick spur of the moment mouse click to make a buying decision. Give them a couple of extra pages to move through and and the outcome at checkout might be different!

  5. #5
    Join Date
    Dec 2011
    Posts
    18
    Plugin Contributions
    0

    Default Re: Better Together Contribution Support Thread

    Hello, thanx for this great mod.
    I'just installed, but i have a problem. I put the code
    Code:
    <?php
    require($template->get_template_dir('/tpl_better_together_xsells.php',DIR_WS_TEMPLATE, 
       $current_page_base,'templates'). '/tpl_better_together_xsells.php');
    ?>
    in tpl product info display, but it cause an error .. nothing display after that code . the require function call the tpl file in the right root ... i can't figure .. please help !!
    Thanx in advance

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,536
    Plugin Contributions
    127

    Default Re: Better Together Contribution Support Thread

    I suspect you stuck this inside a block of PHP code. Put it *after* a

    ?>

    on the next line.
    That Software Guy. My Store: Zen Cart Support
    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.

  7. #7
    Join Date
    Dec 2011
    Posts
    18
    Plugin Contributions
    0

    Default Re: Better Together Contribution Support Thread

    Thanx for the prompt response .. i checked, but .. no . I suspected that the require function call to an unexisting file, but .. no .. ive replaced require with echo and the call is right ... can't figure ..

  8. #8
    Join Date
    Dec 2011
    Posts
    18
    Plugin Contributions
    0

    Default Re: Better Together Contribution Support Thread

    oK, SOLVED THE FIRST PROBLEM, checked the debug file and error was ok 756 raw of ot_better_together.php , uncommented "better_together_admin.php" . Now i've got no error, but ... nothing happens, can't see any doscount, any suggestion ??

  9. #9
    Join Date
    Dec 2011
    Posts
    18
    Plugin Contributions
    0

    Default Re: Better Together Contribution Support Thread

    ok all .. it's ok !! Thanx for this great contribution .. going to study to better adapt to my site ;))

  10. #10
    Join Date
    Nov 2011
    Posts
    34
    Plugin Contributions
    1

    Default Re: Better Together Contribution Support Thread

    Here is a possible fix if like me you sell products that have different tax rates:

    Product A 10% tax
    Product B 0% tax.

    buy Product A and get B at discount. Or buy B and get A at discount.

    Will give you the right result depending on your tax setting in admin.

    i.e for items that have 0% TAX for discount you must set "Include Tax"=false and "Re-calculate Tax"=none

    i.e for items that have X% TAX for discount you must set "Include Tax"=true and "Re-calculate Tax"=Standard

    Possible Fix (test it first)

    open includes/modules/order_total/ot_better_together.php

    and add the following function:

    Code:
    function get_indvidual_tax(){
    	
    	require_once(DIR_WS_CLASSES . 'order.php');
    	$orderz = new order;
    
    	$getid = array();
    	$globTAX = array();
    	
    	for ($i=0, $m=sizeof($orderz->products); $i<$m; $i++) {
    		
    		//gather up all the different types of tax rates used in our cart
    		$getTAX_group = array();
    		foreach ($orderz->products[$i]['tax_groups'] as $j => $value) {
    			$getTAX_group[$j] = $value;
    			if (isset($globTAX[$j]) == false){
    				$globTAX[$j] = 0;
    			}
    		}
    		unset($value);
    		
    		//collect tax rates for each items in our cart
    		$getid[(int)$orderz->products[$i]['id']] = $getTAX_group;
    		
    	}
    	$combinLocalGlob = array();
    	array_push($combinLocalGlob,$getid);
    	array_push($combinLocalGlob,$globTAX);
    	
    	return $combinLocalGlob;
    	
    }
    This function captures the tax rates for each individual products in our basket.

    Now go to the calculate_deductions() function and assign these tax rates to our products.

    replace in the calculate_deductions() function with:

    Code:
        function calculate_deductions() {
           global $db, $order, $currencies;
    
           $od_amount = array();
           $od_amount['tax'] = 0;
    
           $products = $_SESSION['cart']->get_products();
           reset($products);
           $rc = usort($products, "bt_cmp");
           $discountable_products = array();
           // Build discount list 
    	    $getindTAX = $this->get_indvidual_tax(); //collects tax rates from function
    		$getindTAXglobal = $getindTAX[1];// collects all the tax rates used in our cart (will be used to calculate final tax amount)
    		$getindTAXlocal = $getindTAX[0];// collects tax rates for eaxh individual products in cart
    		
           for ($i=0, $n=sizeof($products); $i<$n; $i++) {
                $discountable_products[$i] = $products[$i]; 
    			$discountable_products[$i]['tax_value'] = $getindTAXlocal[(int)$discountable_products[$i]['id']]; // assign the tax rate for each individual item in cart
           }
    
           // Now compute discounts
           $discount = 0;
           for ($i=0, $n=sizeof($discountable_products); $i<$n; $i++) {
                // Is it a twofer? 
                if ($this->is_twofer($discountable_products[$i])) {
                    $npairs = (int)($discountable_products[$i]['quantity']/2);
                    $discountable_products[$i]['quantity'] -= ($npairs * 2);
                    $item_discountable = $npairs * $discountable_products[$i]['final_price'];
    				$discount += $item_discountable;
    				
                    if ($this->include_tax == 'true') {
    					$item_being_discounted = $discountable_products[$i];
    					foreach ($item_being_discounted['tax_value'] as $taxrate => $taxvalue) {
    						//calculate tax amount for discounted item
    						$item_tax_at = ($item_being_discounted['final_price']*$taxvalue)/100;
    						$remove_discount_from_tax = $item_tax_at*($item_discountable/$item_being_discounted['final_price']);
    						//add this amount to the global tax variable (ready to be used to calc tax)
    						$getindTAXglobal[$taxrate] += $remove_discount_from_tax;
    					}
    					unset($taxvalue);  
                    }
                }
    
                // Otherwise, do regular bt processing
                while ($discountable_products[$i]['quantity'] > 0) { 
                    $discountable_products[$i]['quantity'] -= 1;
                    $item_discountable = $this->get_discount(       
                        $discountable_products[$i], $discountable_products);
    					
    				$discount_amount = $item_discountable[0];
    				
    				if (isset($item_discountable[0]) == false){
    					$discount_amount = 0;
    				}
    				
                    if ($discount_amount == 0) { 
                        $discountable_products[$i]['quantity'] += 1;
                        break;
                    } else {
    					$discount += $discount_amount;
                       if ($this->include_tax == 'true') {
    					  $item_being_discounted = $item_discountable[1];
    					  foreach ($item_being_discounted['tax_value'] as $taxrate => $taxvalue) {
    						  //calculate tax amount for discounted item
    						  $item_tax_at = ($item_being_discounted['final_price']*$taxvalue)/100;
    						  $remove_discount_from_tax = $item_tax_at*($discount_amount/$item_being_discounted['final_price']);
    						  //add this amount to the global tax variable (ready to be used to calc tax)
    						  $getindTAXglobal[$taxrate] += $remove_discount_from_tax;
    					  }
    					  unset($taxvalue);
                       }
                    }
                }
           }
    
           $od_amount['total'] = round($discount, 2); 
           switch ($this->calculate_tax) {
           case 'Standard':
              reset($order->info['tax_groups']);
    		  
              while (list($key, $value) = each($order->info['tax_groups']))
              {
                 $tax_rate = zen_get_tax_rate_from_desc($key);
    			 
                 if ($tax_rate > 0) {
    				// this will deduct the correct tax amount for each individual items
                    $od_amount[$key] = $tod_amount = round($getindTAXglobal[$key], 2) ;
                    $od_amount['tax'] += $tod_amount;
                 }
              }
              break;
    
           case 'VAT': 
              reset($order->info['tax_groups']);
              while (list($key, $value) = each($order->info['tax_groups']))
              {
                 $tax_rate = zen_get_tax_rate_from_desc($key);
                 if ($tax_rate > 0) {
                    $od_amount[$key] = $tod_amount = $this->gross_down($od_amount['total']);
                    $od_amount['tax'] += $tod_amount;
                 }
              }
              break;
    
          }
          return $od_amount; 
        }
    you will also need to replace the get_discount function with:

    Code:
        function get_discount($discount_item, &$all_items) {
            $discount = 0; 
            for ($dis=0, $n=count($this->discountlist); $dis<$n; $dis++) {
               $li = $this->discountlist[$dis]; 
    
               // Based on type, check ident1
               if ( ($li->flavor == PROD_TO_PROD) || 
                    ($li->flavor == PROD_TO_CAT) ) {
                  if ($li->ident1 != $discount_item['id']) {
                     continue;
                  }
               } else { // CAT_TO_CAT, CAT_TO_PROD
                  if ($li->ident1 != $discount_item['category']) {
                     continue;
                  }
               }
    
               for ($i=sizeof($all_items) - 1; $i>= 0; $i--) {
                   if ($all_items[$i]['quantity'] == 0) 
                      continue;
                   $match = 0; 
                   if ( ($li->flavor == PROD_TO_PROD) || 
                        ($li->flavor == CAT_TO_PROD) ) {
                      if ($all_items[$i]['id'] == $li->ident2) {
                         $match = 1;
                      }
                   } else { // CAT_TO_CAT, PROD_TO_CAT 
                      if ($all_items[$i]['category'] == $li->ident2) {
                         $match = 1;
                      }
                   }
    
                   if ($match == 1) { 
                       $all_items[$i]['quantity'] -= 1;
                       if ($li->type == "$") {
                          $discount = $li->amt;
                       } else { // %
                          $discount = $all_items[$i]['final_price'] *  
                                      $li->amt / 100;
                       }
    				   
    				   $discount_and_product = array();
    				   array_push($discount_and_product,$discount);//discount amount
    				   array_push($discount_and_product,$all_items[$i]);//item being discounted need to be used to calculate tax
    				   
                       return $discount_and_product;
                   }
               }
            }
    
            return 0;
        }
    now you will have to set "Include Tax"=true and "Re-calculate Tax"=Standard

    and it should work with different tax rated items!

 

 

Similar Threads

  1. Twitter Updates Sidebox Contribution Support Thread
    By delia in forum Addon Sideboxes
    Replies: 13
    Last Post: 29 Dec 2010, 12:44 AM
  2. Better Together Promotional Page Contribution
    By swguy in forum All Other Contributions/Addons
    Replies: 10
    Last Post: 27 Feb 2010, 05:52 PM
  3. Windows Live Product Search Contribution Support Thread
    By numinix in forum All Other Contributions/Addons
    Replies: 209
    Last Post: 3 Jul 2009, 08:23 PM
  4. Better together mod
    By coolman in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 16 Aug 2008, 09:48 PM
  5. LinkConnector Affiliate Contribution Support Thread
    By hyperdogmedia in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 28 Jun 2007, 06:33 PM

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