问题描述
我正在尝试更改Opencart 1.6.5.1的付款扩展名.
I'm trying to change a payment extension of Opencart 1.6.5.1.
我想做的是在PagSeguro系统中显示选项值,此扩展使Opencart和PagSeguro之间建立连接
What I want to do is show the option value in the PagSeguro system, this extension makes the connection between Opencart and PagSeguro
我要编辑的代码位于其中:
The code I want to edit is inside of this:
/*
* Produtos
*/
foreach ($this->cart->getProducts() as $product) {
$options_names = '';
foreach ($product['option'] as $option) {
$options_names .= '/'.$option['name'];
}
// limite de 100 caracteres para a descrição do produto
if($mb_substr){
$description = mb_substr($product['model'].' / '.$product['name'].$options_names, 0, 100, 'UTF-8');
}
else{
$description = utf8_encode(substr(utf8_decode($product['model'].' / '.$product['name'].$options_names), 0, 100));
}
$item = Array(
'id' => $product['product_id'],
'description' => $description,
'quantity' => $product['quantity'],
'amount' => $this->currency->format($product['price'], $order_info['currency_code'], false, false)
);
我要编辑的是这个
foreach ($this->cart->getProducts() as $product) {
$options_names = '';
foreach ($product['option'] as $option) {
$options_names .= ' / '.$option['name'].;
}
然后在pagseguro中显示如下:型号名称/产品名称/选项名称
Then in pagseguro shows like this:Model Name / Product Name / Option Name
但是我要这样
foreach ($this->cart->getProducts() as $product) {
$options_names = '';
foreach ($product['option'] as $option) {
$options_names .= ' / '.$option['name'].': '.$option['value'];
}
以类似的方式在pagseguro中显示:型号名称/产品名称/选项名称:选项值
to show in pagseguro like this:Model Name / Product Name / Option Name: Option Value
但是当我这样做时,出现以下错误:
But when I do this I get the foLlowing error:
我在做什么错了,我该如何解决?
What I'm doing wrong and how can I solve this?
推荐答案
有几种类型的选项,但是几乎所有我认为您想要的不是此索引,如果您转储此选项var,您会发现值"索引是"option_value" $option['option_value']
.
there is several types of options, but in almost all i think what do you want isn't this index, if you dump this option var you will find that the 'value' index, is 'option_value' $option['option_value']
.
从理论上讲,请尝试转储var,如果不使用调试器,请执行以下操作:
Didactically, try dump the var, if you are not using a debugger, do:
var_dump($option); // this will print in a structured way, all values of this array;
exit; // this prevent the rest of code to be executed;
这篇关于注意:未定义的索引:值in的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!