Delivery options?

Locked
Results 1 to 10 of 10
This thread is locked. New replies are disabled.
09 Sep 2006, 11:37
#1
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Delivery options?

Hi all,
Thanks to Merlin I have added the Fedex mod to my existing Royal Mail and they are working great. I have set it up so that Royal Mail does the UK and Fedex does the EU.
My problem is that when I add to cart a product going to the UK Fedex doesn’t show on the page, which is the way I want it, but if I add to cart to the EU the Royal Mail option shows as an option at £0.00 and it can still be selected by a customer. I would rather it didn’t show up on an EU address.
I am grateful for any help
Thanks as all ways
09 Sep 2006, 14:05
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Delivery options?

You can build a function to manage the Shipping Modules based on additional criteria to more or less turn them off/on as needed ...

Currently ... you will see that the modules have a $this->enabled ... if that is false then the module does not run ...

Peek in flat.php ... you will see a function is used to control this for Free Shipping ...
[PHP] // disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
}
[/PHP]

There is a catalog function zen_get_shipping_enabled and an admin function zen_get_shipping_enabled ...

The Admin function returns true ... as we are not "controlling" the module in the Admin ... so we just want it to run ...

You can make your own function based on anything you want to customize the shipping modules ...

[PHP] // disable only when entire cart is free shipping
if (zen_get_my_shipping_test($this->code) {
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
}
}
[/PHP]

The function zen_get_my_shipping_test you then write to return either true or false based on whatever critera based on the shipping module code that is passed to it ... setting the last result to true if nothing as returned false ...
09 Sep 2006, 16:06
#3
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: Delivery options?

It seems to be a habit of mine to look stupid but I’m still lost.
I found the flat.php, found the entry I took a look in the Royal Mail php while I was there but I have no idea what I’m doing with it.
Sorry
09 Sep 2006, 16:11
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Delivery options?

You should see references to the $this->enabled

It may or may not include the code that controlls when it should show in regard to Free Shipping ...

All Shipping Modules should include this ... but not all developers of the modules look ahead to the changes in the core Zen Cart modules to see changes ...

Example:
Free Shipping has automatic adjustment on weight as weight is there or it is not ...

However, those that are based on item or price should us an additional adjustment that allows for Free Shipping for number of items and total price or the shipping is off ...

If you were to add the existing code ... be careful of how it reads, as you want just the IF statement added, not to change the actual line inside the IF ...

Compare flat.php to item.php to usps.php to see the differences ...

I have not looked at the Royal module so I don't have specifics for you ...
09 Sep 2006, 18:00
#5
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: Delivery options?

Yeah it does have a line for $this->enabled
$this->enabled = ((MODULE_SHIPPING_ROYALMAIL_STATUS == 'True') ? true : false);
I can’t see a mention of free delivery but I do have free delivery over £50 to the UK and Royal Mail doesn’t show up on that it also has a couple of lines about zones…

//12 FEB 04 MBeedell NO specified country (or *) then use this zone for all shipping rates
if ($dest_zone == 0) {
for ($i=1; $i<=$this->num_zones; $i++) {
$countries_table = constant('MODULE_SHIPPING_ROYALMAIL_ZONES_COUNTRIES_' . $i);
if ($countries_table == '' or $countries_table == '*') {
$dest_zone = $i;
break;
}
}
}
if ($dest_zone == 0) {
$error = true;
} else {
$shipping = -1;

But it all means nothing to me, sorry
09 Sep 2006, 18:39
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Delivery options?

The override on the Free Shipping that you are using is controlled via the Order Total Module ... Shipping ...

There are other methods to have Free Shipping such as:

0 weight when 0 weight means Free Shipping

Product is marked Always Free Shipping

Product is Virtual

For this, there is the function added to the shipping module to control:
[PHP]$this->enabled = ((MODULE_SHIPPING_ROYALMAIL_STATUS == 'True') ? true : false);[/PHP]

So to get technical, in your case that line should read:

[PHP]
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_ROYALMAIL_STATUS == 'True') ? true : false);
}
[/PHP]

This would turn off the Royal Mail when a Product is marked as Always Free Shipping or a zillion other reasons ... and you would have installed the Shipping Modules Free Shipping freeshipper

That would only show when the shipping is Free and the other shipping modules should be turned off ...

Next, you have an additional condition or criteria for when to offer Royal Mail ...

This is where you can make your own function to work in a similar manner ...
09 Sep 2006, 20:25
#7
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: Delivery options?

Now I’m really feeling stupid coz I’ve been going through it and trying changes and killed it a couple of times but I haven’t been able to make it work the way I need it
09 Sep 2006, 20:52
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Delivery options?

Without taking the time to download the Royal Mail and figuring all this out for you ... it is really hard to break this down further ...
09 Sep 2006, 23:14
#9
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: Delivery options?

Thanks a lot for your help
I'll keep going through it till I beat it into submission
12 Sep 2006, 15:29
#10
billnally avatar

billnally

Zen Follower

Join Date:
Jan 2006
Posts:
251
Plugin Contributions:
0

Re: Delivery options?

Thanks again for all the help and just to let you know I think I’ve fixed it.
I was looking over this bit again (it starts on line 67)

12 FEB 04 MBeedell NO specified country (or *) then use this zone for all shipping rates
if ($dest_zone == 0) {
for ($i=1; $i<=$this->num_zones; $i++) {
$countries_table = constant('MODULE_SHIPPING_ROYALMAIL_ZONES_COUNTRIES_' . $i);
if ($countries_table == '' or $countries_table == '*') {
$dest_zone = $i;
break;
}
}
}

It seemed to say that if the zone wasn’t accepted to return a 0 so I commented out the lot and it sorted it. Now it just comes up with “No shipping available to the selected country”
Thanks again for all your help