Pages:

[en] Field "country select" in order form

Makaron

Avatar: Makaron

2008-08-04 09:43

E-shops which selling their product also to abroad customers probably need to have field in order form which gives possibility to choose country for the customer. When You want to this type of field You have do this:

Firstly You have to add new field sCountry to database. In file db/orders.def.php change the variables declaration:
$aFieldsNames - add in the end of declaration ", 'sCountry' => previous_number_plus_1"
$aFieldsSort - add in the end of declaration ", 'sCountry'"
In function orders( $aExp ) add in the end of array will be returning: ", 'sCountry' => $aExp[previous_number_plus_1]"
In the default free version of shop You can replace "previous_number_plus_1" by 19.
After this changes in file db/orders.php add to every single record character "$".

In files config/lang_pl.php and config/lang_en.php You have to declare array of countries. You can copy this array from here: http://opensolution.org/Quick.Cart/forum/files/countryList.txt

In file actions_admin/orders.php below declaration of variable $sOrderSummary paste this line:

$CountrySelect throwSelectFromArray$aCountryList$aData['sCountry'] );



In file action_client/p.php below declaration of variable $aData['sPagesTree'] paste this line:

$CountrySelect throwSelectFromArray$aCountryList );


also in the same file below declaration of variable $aOrder['sComment'] add this line:

$aOrder['sCountry'] = $aCountryList[$aOrder['sCountry']];



In files lang/en.php and lang/pl.php define variable $lang['Country'].

In file templates/orders_form.tpl in block ORDER_FORM below the block <div id="city"> add this code:

<div id="country">
            <
label for="oCountry">$lang[Country]</label>
            <
select name="sCountry" class="input">
            
$CountrySelect
            
</select>
          </
div>



In file templates/orders_print.tpl below the line:

<dt class="email">$lang[Email]:</dt><dd class="email">$aOrder[sEmail]</dd>


add this one:

<dt class="country">$lang[Country]:</dt><dd class="country">$aOrder[sCountry]</dd>



In file templates/admin/orders.tpl below the line:
<!-- ip end -->
add this code:

<!-- country start -->
      <
tr class="l0">
        <
th>
          
$lang[Country]
        </
th>
        <
td>
            <
select name="sCountry" class="input">
            
$CountrySelect
            
</select>
        </
td>
      </
tr>
      <!-- 
country end -->



For the better look of form in admin panel You should change declaration of classes of next blocks for oposite ex <tr class="l1"> for <tr class="l0">

» Quick.Cart v3.x

heavyn

Avatar: heavyn

2008-08-27 23:36

hi, it works fine, thanks

but I want ask you, how I can use "select countries" for change the shipping price.
Is here solution for set prices for different countries?

If no, I can put every state as 'new carrier' with shipping price, but below customers order form I see table with 20.. more lines - big table. Is possible to use <select> form for this table?

thanks

Quick.Cart v3.0 Ext

beholder

Avatar: beholder

2008-08-27 23:52

you basically want to implement something akin to taxation based on the states (except the 'tax rate' will be a fixed fee that is different for various states). I have done this, you have to change several tpl files as well as php sources as well as javascript. Changes are quite elaborate.

If you're interested in my solution, I have this implemented, for a programmer's day-wage I will share this with you. The whole description is here, along with some other plugins:
http://www.tigerware.sk/easyplugins/

ahahto

Avatar: ahahto

2008-09-13 16:41

This is for version 3, do you have any solution for version 2.2 also ?

beholder

Avatar: beholder

2008-09-15 02:55

no, but it should be easy enough for me to implement it. If you're up for it, I'd do it for programmer's 1 day wage. Contact me using information on this page:
http://www.tigerware.sk/easyplugins/

Oli82

No avatar

2009-06-26 11:31

Hi.

I´ve done all the steps in this thread, but i don´t get the selected country by order-mail.

What is my mistake?

i´ve add following lines to order_print.tpl:
After: $aData[sZipCode] $aData[sCity]

i put this line:
$aData[sCountry]


but the only value, that i get is 0,1,2,3 etc.

Can you help me?

beholder

Avatar: beholder

2009-06-26 12:52

hmm, there is no way we can tell you where you made a mistake. The instructions are there and work.
Perhaps you should just instruct your customer to enter country of residence to the "comment" box.

Oli82

No avatar

2009-06-26 13:07

I´ll try it.

Is the field "$aData[sCountry]" the correct value?

beholder

Avatar: beholder

2009-06-26 20:10

perhaps $aOrder[sCountry]?

samsam

Avatar: samsam

2009-06-30 22:52

Hello friends! I have new field in the amdministration, his name is "Product ID". This field is very important for me. thanks to ID i know what is in order.

I have new field in the administration, it's OK, in the product page is too OK - prodcut database - OK. I add in action_client/products.php this code

    $sIdProduct = !empty( $aData['sIdProduct'] ) ? $oTpl->tbHtml$aData['sTemplate'], 'IDPRODUCTS' ) : null;



and in db/cz_products.def.php

... sIdProduct => 13



This is ok, it really works:)) But i need this field export to orders - how can i do it? I add in db/orders.def.php

.. 'sIdProduct' => previous_number_plus_1

but doesn't work it, in database (db/orders.php) isn't product ID :(

samsam

Avatar: samsam

2009-06-30 22:55

[CZ]
Ahoj, anglina neni moje silna stranka, tak jeste cesky - hezky.) Potrebuji dostat k produktu moznost vlozit jeho unikatni kod - ID a aby se tento kod zobrazil u produktu i v objednavce. Povedlo se i dat kolonku do administrace, kod se ulozi do databaze k produktu a zobrazuje se taky u zbozi v shopu. Ale nedari se mi dostat jej do objednavky - resp. do databaze objednavek. Jde mi jen o to, dostat jej do te databaze, aby se ukazal u zbozi, jako ID a nazev produktu a takto se mi odeslal na mai. Kod je vyse, nevite, v cem delam chybu, ze se mi stale neuklada do te databaze? PHP neumim, jen zkousim podle navodu, co jsem tu nasel. Diky predem za rady!

samsam

Avatar: samsam

2009-07-01 22:40

no idea?

beholder

Avatar: beholder

2009-07-02 13:18

Samsam >> vytvor si vlastny thread a tam sa ti na to pozriem.

MAC60

Avatar: MAC60

2009-07-07 19:40

Hi guys,

The script works fine, country selection is neatly displayed and the country selected shows on the order confirmation form (on the screen after having dispatched the order).

Not so on the e-mail, actually I do have the very same issue as Oli82. The variable $aData[sCountry] (templates/orders_print.tpl) only produces a number instead of the country name. Whereas the number corresponds to the sequence of the country on the country-list.

Therefore, how should the variable look like in order not only to show the number but the country on the e-mail?

Your help is highly appreciated !

Take care
Mac60

beholder

Avatar: beholder

2009-07-07 23:52

you should concatenate it with "city" in PHP, so it gets written to the database. Then you will have it in email too. Or add it to the comment field as "Country: XXX". That is the easy way.

MAC60

Avatar: MAC60

2009-07-08 12:25

Thanks beholder

instead of this script I now used the one suggested by 'idaryl' (http://opensolution.org/Quick.Cart/forum/?p=readTopic&nr=5078), works perfectly alright, including country indicated on the emails to customer & admin.

greetings
Mac60

beholder

Avatar: beholder

2009-07-08 22:49

I forgot about that one, may work well indeed.

piotri

Avatar: piotri

2010-04-30 14:19

Did anyone try to add country select to verison 3.5?
In version 3.2 everything works ok. Nut in version 3.5 Ext I can't do it to work.
When I've changed database the shop didin't load.
Without that, shop is loading, but there is no coutries in list when fulfilling order.

piotri

Avatar: piotri

2010-04-30 14:58

Ok,

Everything works. It was my fault. I fogot about some changes which was done in the shop.

mrngorickets

Avatar: mrngorickets

2011-06-30 15:35

If you want to get more materials that related to this topic, you can visit: http://interviewquestionsandanswers.biz/answers-to-interview-question-what-experience-do-you-have-in-this-field

Best regards.

Pages:
Back to top
about us | contact