WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Bakery Shop => Topic started by: gearup on March 15, 2013, 10:59:12 PM

Title: Block Delivery Destination by Country
Post by: gearup on March 15, 2013, 10:59:12 PM
Hi,

I have been looking at how to do this but cant see what to do without thinking I am going to break something ;)

The situation I have is a shop but I need to block delivery to a country (Switzerland).

Basically we only have an export license for our products so in country sales destinations need to be blocked.

I am thinking the way to do this is to disable the specific country selection when the address is entered during the order process.

There would also need to be a message somewhere like [Switzerland-No] representing a text in the language files,
"delivery to Switzerland is not allowed"
and for the Deutsch pages,
"Lieferung zu die Schweiz ist nicht Erlaubt"

Any hints please..

regards,
Title: Re: Block Delivery Destination by Country
Post by: nibz on March 15, 2013, 11:24:47 PM
https://forum.WebsiteBaker.org/index.php/topic,24377.msg173099.html#msg173099

Check this post...

You can do the same, by removing Switzerland (and more countries if you like).
Title: Re: Block Delivery Destination by Country
Post by: gearup on March 16, 2013, 02:35:29 PM
Thank you nibz,

That post showed me what to do.

I have removed the Switzerland lines from the EN & DE files and now that destination is no longer selectable as I wanted.

I am now trying to display a message which I inserted into the language dir EN & DE files and it is driving me crazy.

For example, I have the text added in the EN file,
Code: [Select]
$MOD_BAKERY['TXT_NO_DELIVERY'] = 'Delivery not Permitted: Switzerland';

and to display it just under the existing message in file form/title.htm
Code: [Select]
<p class ="mod_bakery_form_p_f">{TXT_FILL_IN_ADDRESS}:</p>
<p class ="mod_bakery_form_p_f">{TXT_NO_DELIVERY}--test</p>

however it does not display, I just see --test

what is going on :(

regards,
Title: Re: Block Delivery Destination by Country
Post by: jacobi22 on March 16, 2013, 03:29:59 PM
define the placeholders in the view_form.php
like

Code: [Select]
'TXT_NO_DELIVERY' => $MOD_BAKERY['TXT_NO_DELIVERY'],
i'm not sure about the line, try it in the Placeholders block nearly Line 246
behind this line
Code: [Select]
// Show cust textfields block using template file
                $tpl->set_var(array(

Title: Re: Block Delivery Destination by Country
Post by: gearup on March 16, 2013, 04:04:30 PM
Hi jacobi22,

The line I found was (bakery 1.59) view_form.php,
Code: [Select]
line 296 // Show ship form title using template file
$tpl->set_var(array(
'TXT_NO_DELIVERY' => $MOD_BAKERY['TXT_NO_DELIVERY'],
'TXT_FILL_IN_SHIP_ADDRESS' => $MOD_BAKERY['TXT_FILL_IN_SHIP_ADDRESS']
));
$tpl->parse('form', 'ship_title_block', true);

but it still does not display...

Now I found the right place for this on view_form.php at line 123,
Code: [Select]
'TXT_FILL_IN_ADDRESS' => $MOD_BAKERY['TXT_FILL_IN_ADDRESS'],
'TXT_NO_DELIVERY'           =>  $MOD_BAKERY['TXT_NO_DELIVERY'],

Now it all works and displays fine.

Thx for the support.
Title: Re: Block Delivery Destination by Country
Post by: jacobi22 on March 16, 2013, 04:32:31 PM
Quote
Now I found the right place for this on view_form.php at line 123

good to know - thx
Title: Re: Block Delivery Destination by Country
Post by: gearup on March 17, 2013, 11:08:00 AM
Testing this morning showed a problem.

While removing the country lines in the EN/DE files achieved my goal for the order destination address it caused a problem with the General Settings, shop country & state.

When Switzerland is no longer available this is not good as it is the correct value to be entered here.

I need to put back this change with the EN/DE files and work out some conditional code for the Order process step 1 country selection.

Maybe I could let it be shown but greyed out indicating not selectable.

Update: Man I cant work it out. I just need to disable a selection from a list but it doesnt work for me. I going for a walk, maybe that will help...