PHP experts - Custom Field and Listing Orders

  • Posts: 8
  • Thank you received: 0
10 years 10 months ago #139990

-- url of the page with the problem -- : www.apli.movil-plus.com
-- HikaShop version -- : 2.0.0
-- Joomla version -- : 3.1.5

Good afternoon ,

Request help to display a custom field ( table "item" ) in the list of orders ( listing.php ) .

My PHP skills are scarce, manuals have searched the net and the most I 've gotten is to show the contents of the entire table in the list of orders, however, my only desire is to show the contents of the custom field based on logged user .

By using the following code:


<?php
$conexion=mysql_connect("localhost","XXXXX","")
or die("Problemas en la conexion");

mysql_select_db("base1",$conexion)
or die("Problemas en la selección de la base de datos");

$registros=mysql_query("SELECT imei2 FROM jos_hikashop_order_product",$conexion) or
die("Problemas en el select:".mysql_error());

while ($reg=mysql_fetch_array($registros))
{

echo $reg."<br>";
}

mysql_close($conexion)."<br>";
?>



The result in each row of the column shows ALL records shown in the screenshot , I just like to put the associated order number shown .

I hope someone help me with this problem took a long time and can not find solution.

Greetings and thanks in advance.

Attachments:
Last edit: 10 years 10 months ago by unlockalicante.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #140022

The line:
$registros=mysql_query("SELECT imei2 FROM jos_hikashop_order_product",$conexion) or
die("Problemas en el select:".mysql_error());
is not correct.
You would need instead something like that:
$registros=mysql_query("SELECT imei2 FROM jos_hikashop_order_product WHERE order_id="(int).$row->order_id,$conexion) or
die("Problemas en el select:".mysql_error());

The following user(s) said Thank You: unlockalicante

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
10 years 10 months ago #140027

Hi, thanks for the reply,


I changed the line you and not charge you indicate page is completely blank.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #140055

Turn on the debug mode and error reporting options of the joomla configuration and try again. You should see an error message telling you what's wrong.

The following user(s) said Thank You: unlockalicante

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
10 years 10 months ago #140071

Hi Nicolas,

This is the error:


Parse error: syntax error, unexpected T_INT_CAST in /hosting/www/movil-plus.com/apli/templates/rt_paradigm/html/com_hikashop/order/listing.php on line 143

And the line number 143:

$registros=mysql_query("SELECT imei2 FROM jos_hikashop_order_product WHERE order_id="(int).$row->order_id,$conexion) or die("Problemas en el select:".mysql_error());



Thx

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 10 months ago #140076

Hi,

Using the code tag is better for code display.
At this moment you will see that there was a point between the (int) and the $row->order_id.

Code fixed:

$registros=mysql_query("SELECT imei2 FROM jos_hikashop_order_product WHERE order_id=".(int)$row->order_id,$conexion) or die("Problemas en el select:".mysql_error());

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 10 years 10 months ago by Jerome.
The following user(s) said Thank You: unlockalicante

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
10 years 10 months ago #140078

Perfect!!

Thank you!, This part was essential for my project.

Really, thanks for your attention and speed in the solution.

Please Log in or Create an account to join the conversation.

Time to create page: 0.066 seconds
Powered by Kunena Forum