[Skip to main content](#vessel-content)

#   I need to return two fields

##

- **[jrod](/forum/user/8164-jrod "View jrod's Profile")**
- [![jrod's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8164-jrod "View jrod's Profile") Topic Author
- [ Offline](/forum/user/8164-jrod)

Less More

- Posts: 83
- Thank you received: 10
-
-

14 years 1 month ago -  14 years 1 month ago [\#66790](#66790) by [jrod](/forum/user/8164-jrod "View jrod's Profile")  *[I need to return two fields](/forum/2-general-talk-about-hikashop/66790-i-need-to-return-two-fields#66790 "I need to adjust the shipping&#95;id prior to payment. To do so I need to get the value of two custom fields in order &quot;co&#95;villa&quot; and &quot;co&#95;addon&quot; so that I can apply them to a sql statement.  I then need to set the shipping&#95;id accordingly.  This will be an &quot;include&quot; and run on the payment.php workflow  Please can you help me with the lines that I have drawn attention to above.")* was created by *[jrod](/forum/user/8164-jrod "View jrod's Profile")*

I need to adjust the shipping_id prior to payment. To do so I need to get the value of two custom fields in order "co_villa" and "co_addon" so that I can apply them to a sql statement.

I then need to set the shipping_id accordingly.

This will be an "include" and run on the payment.php workflow
Code:

&lt;?php Include ("databaselogin.php"); //get the customer's villa name and determine if it is an add-on order $thevilla = $this-&gt;co_villa; ********help me with this line please********* $addonorder = $this-&gt;co_addon;********help me with this line please********* if ($addonorder) { $deliveryarea = 3; } else { $theSQL = "SELECT ib_villas.villa_deliverylocation FROM jos_hikashop_zone INNER JOIN ib_villas ON jos_hikashop_zone.zone_id = ib_villas.villa_zone WHERE (((jos_hikashop_zone.zone_type)='ship') AND ((jos_hikashop_zone.zone_namekey)= '" . $thevilla . "'))"; $query = mysql_query($theSQL); while ($result = mysql_fetch_array($query)) { $deliveryarea = $result["villa_deliverylocation"]; } } //at this point the delivery should be 1,2,or 3 depending on the location of the villa and if this is an add-on order $this-&gt;shipping_id == $deliveryarea;********help me with this line please********* ?&gt;

Please can you help me with the lines that I have drawn attention to above.

Last edit: 14 years 1 month ago by [jrod](/forum/user/8164-jrod "View jrod's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY2NzkwLWktbmVlZC10by1yZXR1cm4tdHdvLWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

14 years 1 month ago [\#67027](#67027) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: I need to return two fields](/forum/2-general-talk-about-hikashop/66790-i-need-to-return-two-fields#67027 "I need to adjust the shipping&#95;id prior to payment. To do so I need to get the value of two custom fields in order &quot;co&#95;villa&quot; and &quot;co&#95;addon&quot; so that I can apply them to a sql statement.  I then need to set the shipping&#95;id accordingly.  This will be an &quot;include&quot; and run on the payment.php workflow  Please can you help me with the lines that I have drawn attention to above.")*

It would have helped if you would have given the table of your custom fields.
User ? item ? address ? order ?

Without knowing how your custom fields are configured I can't tell you how to access them.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY2NzkwLWktbmVlZC10by1yZXR1cm4tdHdvLWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jrod](/forum/user/8164-jrod "View jrod's Profile")**
- [![jrod's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8164-jrod "View jrod's Profile") Topic Author
- [ Offline](/forum/user/8164-jrod)

Less More

- Posts: 83
- Thank you received: 10
-
-

14 years 1 month ago -  14 years 1 month ago [\#67029](#67029) by [jrod](/forum/user/8164-jrod "View jrod's Profile")  Replied by *[jrod](/forum/user/8164-jrod "View jrod's Profile")* on topic *[Re: I need to return two fields](/forum/2-general-talk-about-hikashop/66790-i-need-to-return-two-fields#67029 "I need to adjust the shipping&#95;id prior to payment. To do so I need to get the value of two custom fields in order &quot;co&#95;villa&quot; and &quot;co&#95;addon&quot; so that I can apply them to a sql statement.  I then need to set the shipping&#95;id accordingly.  This will be an &quot;include&quot; and run on the payment.php workflow  Please can you help me with the lines that I have drawn attention to above.")*

the two custom fields are in the order table, i put that in the first line, but I can see how it is not clear at all.

Last edit: 14 years 1 month ago by [jrod](/forum/user/8164-jrod "View jrod's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY2NzkwLWktbmVlZC10by1yZXR1cm4tdHdvLWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

14 years 1 month ago [\#67034](#67034) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: I need to return two fields](/forum/2-general-talk-about-hikashop/66790-i-need-to-return-two-fields#67034 "I need to adjust the shipping&#95;id prior to payment. To do so I need to get the value of two custom fields in order &quot;co&#95;villa&quot; and &quot;co&#95;addon&quot; so that I can apply them to a sql statement.  I then need to set the shipping&#95;id accordingly.  This will be an &quot;include&quot; and run on the payment.php workflow  Please can you help me with the lines that I have drawn attention to above.")*

You can do like that:

$app =&amp; JFactory::getApplication();
$order = $app-&gt;getUserState( HIKASHOP_COMPONENT.'.checkout_fields',null);

$thevilla = $order-&gt;co_villa;
...etc...

And to set the shipping id, you will have to do like that:
$app =&amp; JFactory::getApplication();
$app-&gt;setUserState( HIKASHOP_COMPONENT.'.shipping_id',$deliveryarea);

Note that in the payment view, the cart info is already loaded. So you will see the newly selected shipping method only on the next page.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY2NzkwLWktbmVlZC10by1yZXR1cm4tdHdvLWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[jrod](/forum/user/8164-jrod "View jrod's Profile")**
- [![jrod's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/8164-jrod "View jrod's Profile") Topic Author
- [ Offline](/forum/user/8164-jrod)

Less More

- Posts: 83
- Thank you received: 10
-
-

14 years 1 month ago -  14 years 1 month ago [\#67046](#67046) by [jrod](/forum/user/8164-jrod "View jrod's Profile")  Replied by *[jrod](/forum/user/8164-jrod "View jrod's Profile")* on topic *[Re: I need to return two fields](/forum/2-general-talk-about-hikashop/66790-i-need-to-return-two-fields#67046 "I need to adjust the shipping&#95;id prior to payment. To do so I need to get the value of two custom fields in order &quot;co&#95;villa&quot; and &quot;co&#95;addon&quot; so that I can apply them to a sql statement.  I then need to set the shipping&#95;id accordingly.  This will be an &quot;include&quot; and run on the payment.php workflow  Please can you help me with the lines that I have drawn attention to above.")*

returning the two custom fields works perfectly the way you described.

I am not successful in setting the shipping_id though. This is what I have:

Code:

&lt;?php Include ("databaselogin.php"); $app =&amp; JFactory::getApplication(); $order = $app-&gt;getUserState( HIKASHOP_COMPONENT.'.checkout_fields',null); //get the customer's villa name $thevilla = $order-&gt;co_villa; $addonorder = $order-&gt;co_addon; if ($addonorder) { $deliveryarea = 3; } else { $theSQL = "SELECT ib_villas.villa_deliverylocation FROM jos_hikashop_zone INNER JOIN ib_villas ON jos_hikashop_zone.zone_id = ib_villas.villa_zone WHERE (((jos_hikashop_zone.zone_type)='ship') AND ((jos_hikashop_zone.zone_namekey)= '" . $thevilla . "'))"; $query = mysql_query($theSQL); while ($result = mysql_fetch_array($query)) { $deliveryarea = $result["villa_deliverylocation"]; } } // the following line successfully returns a 1,2,or 3 echo $deliveryarea; // the following lines do not set the shipping_id to 1,2, or 3 $app =&amp; JFactory::getApplication(); $app-&gt;setUserState( HIKASHOP_COMPONENT.'.shipping_id',$deliveryarea); ?&gt;

it is the last line that I'm having the issue with:
**$app-&gt;setUserState( HIKASHOP\_COMPONENT.'.shipping\_id',$deliveryarea);**
Note, its not necessary for the shipping choices to actually show, as long as the shipping is adjusted before the credit card is processed.

Last edit: 14 years 1 month ago by [jrod](/forum/user/8164-jrod "View jrod's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY2NzkwLWktbmVlZC10by1yZXR1cm4tdHdvLWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

14 years 1 month ago [\#67151](#67151) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: I need to return two fields](/forum/2-general-talk-about-hikashop/66790-i-need-to-return-two-fields#67151 "I need to adjust the shipping&#95;id prior to payment. To do so I need to get the value of two custom fields in order &quot;co&#95;villa&quot; and &quot;co&#95;addon&quot; so that I can apply them to a sql statement.  I then need to set the shipping&#95;id accordingly.  This will be an &quot;include&quot; and run on the payment.php workflow  Please can you help me with the lines that I have drawn attention to above.")*

You will probably also need to add additional code to give the shipping data:

$app =&amp; JFactory::getApplication();
$app-&gt;setUserState( HIKASHOP_COMPONENT.'.shipping_id',$deliveryarea);
$class = hikashop_get('class.shipping');
$shipping = $class-&gt;get($deliveryarea);
$app-&gt;setUserState( HIKASHOP_COMPONENT.'.shipping_method',$shipping-&gt;payment_type);
$app-&gt;setUserState( HIKASHOP_COMPONENT.'.shipping_data',$shipping);

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY2NzkwLWktbmVlZC10by1yZXR1cm4tdHdvLWZpZWxkcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.052 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
