Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    27
    Plugin Contributions
    0

    Default Postage rates by Attribute

    OK, here is the thing:

    Due to Royal Mail having pricing by proportion, my problem is that many items can be posted by Large Letter. If I have an attribute, I need to change it to Packet rate.
    I currently do this with some products by using products_type.

    The query is currently:
    Code:
          if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_options_value_id','2') > 0)) {
              $this->enabled = false;
          } 
     
     {
              // Enable option otherwise
              $this->enabled = true;
    Is it possible to do something similar based on attributes.

    I need to check for options_values_id in products_attributes to see if it is 74 or 75, so I can disable the large letter rate. (which is what the code above is taken from.

    Many thanks.

  2. #2
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    27
    Plugin Contributions
    0

    Default Re: Postage rates by Attribute

    Whoops, I messed that up. I copied the code, I had tried tweaking.

    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_type','2') > 0)) {
    $this->enabled = false;
    }

    {
    // Enable option otherwise
    $this->enabled = true;

  3. #3
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    27
    Plugin Contributions
    0

    Default Re: Postage rates by Attribute

    Think I posted this in the wrong section.

    Anyway, I have figured out a solution which appears to work.

    In the relevant postage section (rm2ndlargeletter.php) I added the following lines:

    Code:
    	Just after the global $order, $total_weight ;
    $query = 'SELECT products_options_value_id FROM customers_basket_attributes WHERE products_options_value_id >= 74';
    	$this->prod_attrib = mysql_query($query);
    
    and further down after } // end of looping through
    
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_type','2') > 0))
    		{
    		$this->enabled = false;
    		return ;
    		}
    
    	elseif(mysql_num_rows($this->prod_attrib)!=0){
    		
    		$this->enabled = false;
    		}else{
              // Enable option otherwise
    		$this->enabled = true;
    		}		  
    		return ;
    That takes into account the product type of 2, then does a query on the basket to see if there are any items with the attributes of >73 which for me means gift boxes. If so, de-activates this shipping method.
    The same code needs inserting into the rm2ndpacket.php but changing the false to true and the true to false.

    Similare is done for signed for and 1st class.

    Maybe not the best way to do it but then, I am no PHP programmer :).

    Thought I would share that incase anyone could use it or improve on it.

 

 

Similar Threads

  1. USPS Rates too low since postage increase
    By jplanet in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 25 Jun 2009, 05:04 AM
  2. Multiple Postage Rates for the UK (Letter/Packet)
    By bargaindropper in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 8 Feb 2009, 10:40 AM
  3. How do I set up postage rates for different countries?
    By Impact-Flies in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 10 Jan 2009, 06:32 PM
  4. Zone rates - specific country not calculating postage
    By robmurg in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 12 Apr 2008, 01:44 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