2016-02-26 54 views
-2

我在opencart 2.0.0.1上工作 我有兩種付款方式COD和一種支付網關,我想在結帳的步驟5:付款方式中添加支付網關標識和COD圖像。我想在結帳的步驟5中添加支付方式徽標

enter image description here

我想在結賬添加圖像編碼/ payment_method.tpl這裏是代碼..

<?php if ($payment_methods) { ?> 
 
<p><?php echo $text_payment_method; ?></p> 
 
<?php foreach ($payment_methods as $payment_method) { ?> 
 
<div class="radio"> 
 
    <label> 
 
    <?php if ($payment_method['code'] == $code || !$code) 
 
\t { ?> 
 
    <?php $code = $payment_method['code']; ?> 
 
\t \t <input type="radio" name="payment_method" value="<?php echo $payment_method['code']; ?>" checked="checked" /> 
 
    <?php 
 
\t } else 
 
\t { ?> 
 
    <input type="radio" name="payment_method" value="<?php echo $payment_method['code']; ?>" /> 
 
    <?php 
 
\t } ?> 
 
\t 
 
    <?php echo $payment_method['title']; ?> 
 
    <?php if ($payment_method['terms']) { ?> 
 
    (<?php echo $payment_method['terms']; ?>) 
 
    <?php } ?> 
 
    </label> 
 
</div> 
 
<?php } ?> 
 
<?php } ?>

+0

我希望每次付款方式的形象或標誌在這段代碼 – amisha

回答

1

我有一個溶液

可以手動檢查付款方法代碼和在結帳/ PAYMENTMETHOD控制器增加圖象

if ($method) 
 
\t \t \t \t \t { 
 
\t \t \t \t \t \t if($method['code']=="cod") 
 
\t \t \t \t \t \t { 
 
\t \t \t \t \t \t \t $method['image'] = "<img src='image/COD.jpg' style='width:200px; height:100px'/>"; 
 
\t \t \t \t \t \t } 
 
\t \t \t \t \t \t else if($method['code']=="cheque") 
 
\t \t \t \t \t \t { 
 
\t \t \t \t \t \t \t $method['image'] = "<img src='image/payumoney.jpg' style='width:200px; height:100px'/>"; 
 
\t \t \t \t \t \t } 
 
\t \t \t \t \t \t if ($recurring) { 
 
\t \t \t \t \t \t \t if (method_exists($this->{'model_payment_' . $result['code']}, 'recurringPayments') && $this->{'model_payment_' . $result['code']}->recurringPayments()) { 
 
\t \t \t \t \t \t \t \t $method_data[$result['code']] = $method; 
 
\t \t \t \t \t \t \t } 
 
\t \t \t \t \t \t } else { 
 
\t \t \t \t \t \t \t $method_data[$result['code']] = $method; 
 
\t \t \t \t \t \t } 
 
\t \t \t \t \t \t 
 
\t \t \t \t \t \t //$method_data[$result['image']] = "<img src='image/payumoney.jpg' style='width:50px; height:50px'/>"; 
 
\t \t \t \t \t }

和觀點也改變

<div class="radio payment_style" id="parent<?=$counter?>" for="radio<?=$counter?>"> 
 
\t \t <label> 
 
\t \t \t <?php if ($payment_method['code'] == $code || !$code) 
 
\t \t \t { ?> 
 
\t \t \t <?php $code = $payment_method['code']; ?> 
 
\t \t \t \t <input id="radio<?=$counter?>" type="radio" name="payment_method" value="<?php echo $payment_method['code']; ?>" checked="checked" class="hide payment_radio" onclick="change_payment_method('<?=$counter?>')"/> 
 
\t \t \t <?php 
 
\t \t \t } else 
 
\t \t \t { ?> 
 
\t \t \t \t <input type="radio" id="radio<?=$counter?>" class="hide payment_radio" name="payment_method" value="<?php echo $payment_method['code']; ?>" onclick="change_payment_method('<?=$counter?>')" /> 
 
\t \t \t <?php 
 
\t \t \t } ?> 
 
\t \t \t 
 
\t \t \t <div class="radimg"><?php echo $payment_method['image']; ?> </div> 
 
\t \t \t <?php /* echo $payment_method['title']; */?> 
 
\t \t \t <?php if ($payment_method['terms']) { ?> 
 
\t \t \t (<?php echo $payment_method['terms']; ?>) 
 
\t \t \t <?php } ?> 
 
\t \t </label> 
 
\t \t </div>

2

我剛下2.1.0.2至極測試的基本相同的結構。 首先導航到/catalog/model/payment/cheque.php發現:

'title'  => $this->language->get('text_title'), 

,取而代之的是:

'title'  => $this->language->get('img_title') . $this->language->get('text_title'), 

然後導航到/語言/英文/支付/檢查。 PHP 這增加了底部:

$_['img_title']   = '<img src="' . HTTPS_SERVER . 'image/check.jpg" alt="Check" title="Check" /></a>'; 

更改名稱/升您希望在上面的代碼中的「和」之間使用圖像。並將alt =「」和title =「」更改爲您在前工作時的當前付款。 ALT = 「COD」 或ALT = 「貝寶」 ......

這適用於您添加或在Opencart的默認(鱈魚,貝寶,銀行電匯,ECT)

不要任何報酬不要忘了讓圖像變成你想要的尺寸。希望這可以幫助。

成品結果

enter image description here

+0

BTW,這也適用於航運標識也只是改變自繳費的位置航運中上面的鏈接。 – DSKONLINE

+0

先生您的答案是正確的,但我需要添加每個付款方式的圖像或標誌 – amisha

+0

只需重複每個付款過程(cod.php,pp_express.php,bank_transfer.php) – DSKONLINE