Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Abstract Zones


Guest

Recommended Posts

The Abstract Zones module provides an efficient way to associate products and categories with shipping, payment, order total modules and in general with the osCommerce catalog end. This module primary target is an association between the shipping modules and the catalog products.

 

Shipping modules can now be enabled or disabled automatically during checkout based on the assigned products and/or categories. Abstract zones can be defined on the osC admin end in a fast way.

 

Contribution Thread:

http://www.oscommerce.com/community/contributions,4416

Edited by enigma1
Link to comment
Share on other sites

  • 4 weeks later...

Function tep_get_cat_zone_name is missing from the documentation. Item 3 should read:

 

//-MS Active Shipping Added
 function tep_cfg_pull_down_active_zones($zone_id, $key = '') {
$name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value');

$zone_array = array(array('id' => '0', 'text' => TEXT_NONE));
$zone_query = tep_db_query("select cat_zone_id, cat_zone_name from " . TABLE_CAT_ZONES . " order by cat_zone_name");

while ($zone = tep_db_fetch_array($zone_query)) {
  $zone_array[] = array('id' => $zone['cat_zone_id'],
						'text' => $zone['cat_zone_name']);
}
return tep_draw_pull_down_menu($name, $zone_array, $zone_id);
 }

 function tep_get_active_zone_title($zone_id) {
if ($zone_id == '0') {
  return TEXT_NONE;
} else {
  $zone_query = tep_db_query("select cat_zone_name from " . TABLE_CAT_ZONES . " where cat_zone_id = '" . (int)$zone_id . "'");
  $zone = tep_db_fetch_array($zone_query);

  return $zone['cat_zone_name'];
}
 }

 function tep_get_cat_zone_name($cat_zone_id, $default_zone='Unknown Zone') {
$zone_query = tep_db_query("select cat_zone_name from " . TABLE_CAT_ZONES . " where cat_zone_id = '" . (int)$cat_zone_id . "'");
if (tep_db_num_rows($zone_query)) {
  $zone = tep_db_fetch_array($zone_query);
  return $zone['cat_zone_name'];
} else {
  return $default_zone;
}
 }
//-MS Active Shipping Added EOM

 

documentation will be updated with the next version

Link to comment
Share on other sites

just wanted to let you know, i replaced the old code with the new (above) and re-uploaded the original shipping_zones.php.

 

still not working for me. it worked last night when i removed the php code.

 

error:

Shipping Zones

Fatal error: Call to undefined function: tep_get_cat_zone_name() in .../catalog/admin/shipping_zones.php on line 233

 

any ideas?

Link to comment
Share on other sites

okay, everything is working great. i mean there's no errors and no complications. the only thing is i have removed the following from shipping_zones.php:

 

		  <tr>
		<td class="pageHeading">
<?php 
 echo HEADING_TITLE; 
 if (isset($HTTP_GET_VARS['zID']) && tep_not_null($HTTP_GET_VARS['zID']) ) 
echo ' » ' . tep_get_cat_zone_name($HTTP_GET_VARS['zID']);
?>
		</td>
	  </tr>

 

even with the new application_top code.

 

what does 'zID' mean?

Link to comment
Share on other sites

i will look more into this error in the next couple days. i will get back to you with more info on why this is occuring. it's weird cause WHEN the missing function is added and the above php code is present i still get the error. removing the php code will prevent the error from occuring.

 

i don't get the error when the missing function is missing just as long as the above php code is removed.

 

i'll get back to you after i look at your code in it's entirety and figure out what's causing the error.

Edited by KemoSabe
Link to comment
Share on other sites

  • 3 months later...
The Abstract Zones module provides an efficient way to associate products and categories with shipping, payment, order total modules and in general with the osCommerce catalog end. This module primary target is an association between the shipping modules and the catalog products.

 

Shipping modules can now be enabled or disabled automatically during checkout based on the assigned products and/or categories. Abstract zones can be defined on the osC admin end in a fast way.

 

Contribution Thread:

http://www.oscommerce.com/community/contributions,4416

 

I haven't found much information about this contrib in the forum. I am wondering if it will work for my purposes. I am using MS2.2 with many, many mods, including Active Countries and Additional Shipping Options for Zone and I am using 5 different shipping modules (Bus collect, Bus prepaid, customer pickup, and 2 zones mail and xpress defined from additional shipping options for zones. I mention these in case it affects this contrib).

 

I have a number of different products, some like a catalog or gift certificates which I do not wish to charge shipping on. I also have some products which are heavy and I would like to charge a set rate for those items over and above the regular shipping charges which are calculated on the total of the order. It sounds like your contrib will work for this purpose? My main concern is conflict with the additional shipping for zones contrib and that the correct shipping total would be reached if a customer were to order a product where the shipping cost is calculated on the total, another with a set amount, and another that has free shipping. The catalog is down for maintenance at the moment as we get ready for our next shipping season.

 

Looking forward to your reply.

Link to comment
Share on other sites

  • 3 months later...

I have uploaded all the new and modified files but when I go to my Admin CP I do not have a

 

osC Admin->Location/Taxes->Shipping Zones

 

This is all that is in that block.

 

Locations / Taxes

Countries

Zones

Tax Zones

Tax Classes

Tax Rates

 

Localization

 

 

 

I tried re uppping everything but nothing is showing.

Link to comment
Share on other sites

I have uploaded all the new and modified files but when I go to my Admin CP I do not have a

 

osC Admin->Location/Taxes->Shipping Zones

 

This is all that is in that block.

 

Locations / Taxes

Countries

Zones

Tax Zones

Tax Classes

Tax Rates

 

Localization

 

I tried re uppping everything but nothing is showing.

 

 

Opps can you delete this message. I figured it out . Sorry

Link to comment
Share on other sites

same error:

 

Fatal error: Call to undefined function: tep_get_cat_zone_name() in .../catalog/admin/shipping_zones.php on line 233

 

 

When I remove

<tr>
		<td class="pageHeading">
<?php 
 echo HEADING_TITLE; 
 if (isset($HTTP_GET_VARS['zID']) && tep_not_null($HTTP_GET_VARS['zID']) ) 
echo ' » ' . tep_get_cat_zone_name($HTTP_GET_VARS['zID']);
?>
		</td>
	  </tr>

 

I get the following error when trying to add categories

 

Warning: Invalid argument supplied for foreach() in /mnt/w0201/d09/s14/b02a7676/www/seafood_market/catalog/admin/shipping_zones.php on line 105

 

Warning: Cannot modify header information - headers already sent by (output started at /mnt/w0201/d09/s14/b02a7676/www/seafood_market/catalog/admin/shipping_zones.php:105) in /mnt/w0201/d09/s14/b02a7676/www/seafood_market/catalog/admin/includes/functions/general.php on line 22

Link to comment
Share on other sites

  • 5 weeks later...
Has the code added in post #2 been added to the version that is available from the Contrib page?

no it hasn't, is missing from the documentation

 

The next version of the abstract zones will be a quite different framework.

Link to comment
Share on other sites

Hi Mark,

 

I hope you are well!

 

I have this working really well, at the moment I have 2 flat rate shipping modules setup as

 

Flat Rate 1 - £25.00

Flat Rate 2 - £4.95

 

The £25 delivery charge is for a washing machine and the £4.95 is say for a dvd.

 

Now if the customer adds a washing machine and a dvd to the shopping cart then the shipping page shows both delivery options.

 

Any ideas on how I would get around this so it would only show the higher delivery charge where there is enough markup in the higher value product to encompass the shipping cost of the dvd or if there is a better way to do it then I am open to your suggestions.

 

Regards

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Hi Mark,

 

I hope you are well!

 

I have this working really well, at the moment I have 2 flat rate shipping modules setup as

 

Flat Rate 1 - £25.00

Flat Rate 2 - £4.95

 

The £25 delivery charge is for a washing machine and the £4.95 is say for a dvd.

 

Now if the customer adds a washing machine and a dvd to the shopping cart then the shipping page shows both delivery options.

 

Any ideas on how I would get around this so it would only show the higher delivery charge where there is enough markup in the higher value product to encompass the shipping cost of the dvd or if there is a better way to do it then I am open to your suggestions.

 

Regards

 

Mark

 

All is well, thanks hope the same for you.

 

One way is to create a separate flat rate module that will deal with both items (meaning will process all items from an abstract zone).

 

1. So say this module is called flat_combo

2. Assign both (or all the products/categories associated with this behavior into the same abstract zone)

3. in the quote function of the flat_combo module, you can get the highest shipping rate.

// class methods
function quote($method = '') {
  global $order;

so you add beneath a for loop to identify the products shipping price. (Not sure how you have that now is probably a separate shipping per product or something?) Assuming that you have the order class that can hold the shipping price. So:

$max_cost = 0;
foreach($order->products as $key => $value) {
 if( $value['shipping_price'] > $max_cost )
 $max_cost = $value['shipping_price'];
}

 

4. finally simply change the cost element further down

from this:

	  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_FLAT_COMBO_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_FLAT_COMBO_TEXT_WAY,
												 'cost' => MODULE_SHIPPING_FLAT_COMBO_COST)));

 

to this:

	  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_FLAT_COMBO_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_FLAT_COMBO_TEXT_WAY,
												 'cost' => $max_cost)));

 

Now I assume you have something in place already where you define separate shipping per item. Set the flat_combo module to operate under the specific abstract zone and mode to "inclusive".

Edited by enigma1
Link to comment
Share on other sites

forgot to mention, the loop there, checks all items in an order. If you only need the items of the zone, you need a separate function in your general.php to return only the ids of the zone's products and check against those only.

Edited by enigma1
Link to comment
Share on other sites

Hi Mark,

 

Many thanks for your prompt response.

 

I have no individual shipping prices, the only shippig modules active are the one that you supplied with this contrib and a modded duplicate basically making it 2 flat rate shipping modules with different names and different prices.

 

So would this affect the code above or could I use it as is off the belt.

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Hi Mark,

 

Many thanks for your prompt response.

 

I have no individual shipping prices, the only shippig modules active are the one that you supplied with this contrib and a modded duplicate basically making it 2 flat rate shipping modules with different names and different prices.

 

So would this affect the code above or could I use it as is off the belt.

 

Mark

 

Then in that case wait for v2.00. Basically the abstract zone will be a base framework with plugins. One of them will include the current functionality plus shipping prices per product or per category.

Link to comment
Share on other sites

Oh Mark why did you have to say that >_<

 

I could really do with getting this sorted now because it would be a major headache to not have it.

 

I wish you could see me crying real tears over this one :'(

 

I am quite happy to go with a few hacks to get me by until version 2 is available.

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Ok then do this:

 

in your flat_rate_1 module that handles all regular items you have this code:

//-MS- Active Shipping Added
  if( $this->enabled == true && function_exists('tep_check_active_zone') ) {
	$this->enabled = tep_check_active_zone(MODULE_SHIPPING_FLAT_ACTIVE_ZONE, MODULE_SHIPPING_FLAT_ACTIVE_MODE);
  }
//-MS- Active Shipping Added EOM

 

Change the code above add below this line

$this->enabled = tep_check_active_zone(MODULE_SHIPPING_FLAT_ACTIVE_ZONE, MODULE_SHIPPING_FLAT_ACTIVE_MODE);

 

this code:

		if(tep_check_active_zone('Overweight', 'Inclusive'))
	  $this->enabled = false;

 

create an 'Overweight' zone put the washing machine in it. Make sure the washing machine is not with any other abstract zone.

Assign the 'Overweight' zone to flat_rate_2 module. So flat_rate_2 will be activated if the washing machine is in, and at the same time flat_rate_1 will be deactivated.

Link to comment
Share on other sites

Ok then do this:

 

in your flat_rate_1 module that handles all regular items you have this code:

//-MS- Active Shipping Added
  if( $this->enabled == true && function_exists('tep_check_active_zone') ) {
	$this->enabled = tep_check_active_zone(MODULE_SHIPPING_FLAT_ACTIVE_ZONE, MODULE_SHIPPING_FLAT_ACTIVE_MODE);
  }
//-MS- Active Shipping Added EOM

 

Change the code above add below this line

$this->enabled = tep_check_active_zone(MODULE_SHIPPING_FLAT_ACTIVE_ZONE, MODULE_SHIPPING_FLAT_ACTIVE_MODE);

 

this code:

		if(tep_check_active_zone('Overweight', 'Inclusive'))
	  $this->enabled = false;

 

create an 'Overweight' zone put the washing machine in it. Make sure the washing machine is not with any other abstract zone.

Assign the 'Overweight' zone to flat_rate_2 module. So flat_rate_2 will be activated if the washing machine is in, and at the same time flat_rate_1 will be deactivated.

 

Hi Mark,

 

Ok I have done that, did I need to still make the changes you suggested earlier or not??

 

If not then the 'Overweight' system works fine until I create say another abstract zone called 'Other' and then assign that to a second flat rate shipping module with a price of £4.95.

 

If I dont create another abstract group and assign it to a shipping module then no shipping options are displayed at all.

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Ok I have done that, did I need to still make the changes you suggested earlier or not??

not you don't want the earlier post. that was only if you had a separate shipping cost module in place.

 

If not then the 'Overweight' system works fine until I create say another abstract zone called 'Other' and then assign that to a second flat rate shipping module with a price of £4.95.

Yes you need another zone like the "Other" that you made that will bring up your regular flat rate module. (4.95)

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...