Jump to content

Enable/disable shipping carrier based on weekday and weekend


Recommended Posts

Using latest 1.6 version

Standard theme

 

I have different types of shipping carrier, one of them is the same day delivery which I want to disable in specific day of week,for example available all days of week except Saturday.

Link to comment
Share on other sites

I guess you can modify  getAvailableCarrierList, Cart.php file. Can't tell you where exactly off the top of my head, just check $carrierList at the very end, loop through it and check against the static carrier id (not id_carrier, which changes every time you save one, but the static id_reference) if it's the one  you want to disable.
If date('D') == the day you want to disable it, then unset it from the list.

I might write a quick tut about it, interesting question!

Link to comment
Share on other sites

Thank you for your swift reply, I appreciate the instructions you suggested. However, I'm not well-versed in PHP programming and it's difficult for me to apply unless I have specific and clear instructions. I attempted to search in cart.php, but it didn't help. Can you please provide step-by-step clear instructions? Thank you in advance.

Link to comment
Share on other sites

Thank you very much it worked. But I couldn't make in the override, so I added the new codes directly in both classes/Carrier.php and controllers/admin/AdminCarrierWizardController.php

 

It works nicely now for me. Do you think I did a mistake by adding directly to the original files?

Link to comment
Share on other sites

  • 4 months later...

 

Hi Nemo,

 

Thank you very much for this great tutorial!

 

Im using PS1.7.1.2 and my situation is very similar to OP's. I need to use time of day instead of date. What modifications do I have to do so your tutorial can work in my case?

 

I have a delivery method that can deliver orders right away to customers living in the same city. Customers can only choose this option if they place an order between my business hours, or a time that I can specify myself and edit later in back office when needed (example: between 10AM to 6PM). If a customer goes to checkout between this specified time, then they have the ability to choose this delivery method if they want, but I don't want them to be able to choose this delivery method when it's outside of my specified hours.

 

Can you help me achieve this? I would appreciate it very much. My business is built around delivering orders right away to customers in the same city and I couldn't find a paid module for this kind of thing.

Edited by BlackEdition (see edit history)
Link to comment
Share on other sites

This can't really be done by default, it needs quite a modification or rather a new module, unfortunately :(

I can't think of a proper solution for 1.7, you might try adding timespans like 12-14 or so, and act accordingly

 

I honestly know nothing about programming so I can't do what you asked lol.

 

Do you know any paid modules that can do this job for me? or at least something that can make it work with your solution?

If not, then is it possible that you can custom make a module like this for me (for a fee of course)? Or better, you can design a paid module that does this sort of thing with the choice of (either days or time) and put it on sale on your website then i'll be able to buy it and so does every one out there instead of just a custom private module for me. 

 

Thanks

Edited by BlackEdition (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...