VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: eriksimonx on June 19, 2013, 13:24:51 PM

Title: Shipment address from database
Post by: eriksimonx on June 19, 2013, 13:24:51 PM
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