We're using the built in Paypal Standard payment system on Opencart but it is not pulling the option price to Paypal.
Here is the code we have in our pp_standard.tpl file
<?php $i = 1; ?>
<?php foreach ($products as $product) { ?>
<input type="hidden" name="item_name_<?php echo $i; ?>" value="<?php echo $product['name']; ?>" />
<input type="hidden" name="item_number_<?php echo $i; ?>" value="<?php echo $product['model']; ?>" />
<input type="hidden" name="amount_<?php echo $i; ?>" value="<?php echo $product['price']; ?>" />
<input type="hidden" name="quantity_<?php echo $i; ?>" value="<?php echo $product['quantity']; ?>" />
<input type="hidden" name="weight_<?php echo $i; ?>" value="<?php echo $product['weight']; ?>" />
<?php $j = 0; ?>
<?php foreach ($product['option'] as $option) { ?>
<input type="hidden" name="on<?php echo $j; ?>_<?php echo $i; ?>" value="<?php echo $option['value']; ?>" />
<input type="hidden" name="os<?php echo $j; ?>_<?php echo $i; ?>" value="<?php echo $option['price']; ?>" />
<?php $j++; ?>
<?php } ?>
<?php $i++; ?>
<?php } ?>
I think the line that is the issue is this
<input type="hidden" name="os<?php echo $j; ?>_<?php echo $i; ?>"
value="<?php echo $option['price']; ?>" />
But I am not sure what to change it to for Paypal to pull the correct price
Here is the code that shows the price in the cart.tpl file
<?php foreach ($product['option'] as $option) { ?>
- <small><?php echo $option['name']; ?>: <?php echo $option['value']; ?>
- Price: <?php echo $option['price']; ?></small><br />
you can't use counter with paypal standard hidden inputs like amount
, item_name
and other hidden inputs inside foreach
<input type="hidden" name="amount_<?php echo $i; ?>" value="<?php echo $product['price']; ?>" />
in your case, paypal is looking request from input="amount"
and you are posting request through input="amount_1"