News:

Support the VirtueMart project and become a member

Main Menu

Shipment address from database

Started by eriksimonx, June 19, 2013, 13:24:51 PM

Previous topic - Next topic

eriksimonx

I am trying to make a shipment method, which sets the shipment address automatically.

I made the shipment method, I can select the address from a form. After this, the chosen <option>'s ID is stored in a cookie. On the cart page, based on the ID, I put informations from the database into the vm cart's shipment array ($this->cart->ST). On the cart page, the shipment infos are displayed well inside the div.

My problem is, that on the invoice, in the email, and in the virtuemart admin, the shipment address is the same as the billing address or empty.

If I edit the shipment address manually, that works, but the array's structure is the same, so I don't know why it doesn't work with my automatic array.

My code in default_pricelist.php:

$postapont = $_COOKIE['hova_cookie'];
$shipment_id = $_COOKIE['shipment_id_cookie'];

$con=mysql_connect("xxxxx","xxxxx","xxxxx");
$result = mysql_query('SELECT nev,utca,iranyitoszam,varos FROM '.$postapont.' WHERE id = "'.$shipment_id.'"');
$row = mysql_fetch_array($result);

$this->cart->ST = array("company" => $row[0],"address_1" => $row[1], "zip" => $row[2], "city" => $row[3]);


I'm using Joomla 2.5.9 and VritueMart 2.0.18a