English 中文(简体)
delivery format for sagepay basket
原标题:
  • 时间:2011-02-19 10:44:10
  •  标签:
  • php
  • opayo

sage pay is throwing an error about my basket. if i take the delivery part off then it works but i want delivery on.

// Ordering Shopping Basket
    // 
    $ThisBasket = count( $items );
    foreach( $items as $item ) {
        preg_match( "#^[([^]]+)][([^]]+)][([^]]+)]$#is", $item, $match );
        $ThisBasket .=  :  . $match[2]; // Item Name ( - attribute/options )
        $ThisBasket .=  :  . $match[1]; // Quantity
        $ThisBasket .=  :  . self::$cp . ( $match[3] / $match[1] ); //Item Value
        $ThisBasket .=  :  . self::$cp . global_data::get_vat( $match[3] / $match[1], true ); // Item Tax
        $ThisBasket .=  :  . self::$cp . global_data::get_vat( $match[3] / $match[1] ); // // Item Total
        $ThisBasket .=  :  . self::$cp . global_data::get_vat( $match[3] ); // // Line Total
    }
    $ThisBasket .=  :Delivery:1:  . self::$cp .  4.99:---:  . self::$cp .  4.99:  . self::$cp .  4.99 ;

I have no idea how the delivery is structured and cannot find any documentation. regards phil

问题回答

From the VSP Direct documentation (formatted appropriately):

Item                   Quantity   Item value  Item tax  Item Total  Line Total
Sound system           1          424.68      74.32     499.00      499.00
Donnie Darko           3          11.91       2.08      13.99       41.97
Finding Nemo           2          11.05       1.94      12.99       25.98
Delivery               ---        ---         ---       ---         4.99

Would be represented thus:

4:Pioneer NSDV99 DVD-Surround Sound System:1:424.68:74.32:499.00: 499.00:Donnie Darko Director’s Cut:3:11.91:2.08:13.99:41.97: Finding Nemo:2:11.05:1.94:12.99:25.98:Delivery:---:---:---:---:4.99

So it looks like you just need to include the total of the delivery, with --- as appropriate to complete the blank fields. Not sure what self::$cp is in your code, but if you have the total, just use that.





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签