Php 签出期间的Magento数据库复选框
我在Magento网站上工作 我在结帐页面添加了一个复选框,确认他们授权该公司向其信用卡收费,并确认退货和退款政策。(如下所示) 在您看到订单的管理区域,我添加了一行,上面写着“授权收费:”当前,如果我在“我已设置”列中手动将值输入数据库,它将正确读取并显示 我需要的帮助是使复选框在数据库的列中插入Yes或No app/design/frontend/base/default/template/payment/form/Ccsave.phtml上的复选框代码Php 签出期间的Magento数据库复选框,php,html,magento,Php,Html,Magento,我在Magento网站上工作 我在结帐页面添加了一个复选框,确认他们授权该公司向其信用卡收费,并确认退货和退款政策。(如下所示) 在您看到订单的管理区域,我添加了一行,上面写着“授权收费:”当前,如果我在“我已设置”列中手动将值输入数据库,它将正确读取并显示 我需要的帮助是使复选框在数据库的列中插入Yes或No app/design/frontend/base/default/template/payment/form/Ccsave.phtml上的复选框代码 <li> &l
<li>
<div class="input-box">
<input type="checkbox" id="<?php echo $_code ?>_cc_checkbox"" name="payment[cc_checkbox]" title="<?php echo $this->__('By checking this box, I authorize this transaction and acknowledge the refund/exchange policy discussed in the "customer care" section of the website.') ?>" class="input-text validate-cc-checkbox validate-cc-type" value="Yes" />
<label for="<?php echo $_code ?>_cc_checkbox" class="required"><em>*</em><?php echo $this->__('By checking this box, I authorize this transaction and acknowledge the refund/exchange policy discussed in the "customer care" section of the website.') ?></label>
</div>
</li>
app/Code/core/Mage/Payment/Block/Info/Ccsave.php上的复选框代码(显示在后端)
像这样的代码应该放在哪里
<?php $cc_checkbox = $_GET["cc_checkbox"];
require_once 'app/Mage.php';
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$writeConnection = $resource->getConnection('core_write');
$tableName = $resource->getTableName('sales_flat_order_payment');
if ($cc_checkbox == true) {
$checked="Yes";
$query = "UPDATE INTO {$tableName} (cc_checkbox)
VALUES ('Yes')";
}
else {
$checked="No";
$query = "INSERT INTO {$tableName} (cc_checkbox)
VALUES ('No')";
}
$writeConnection->query($query);
?>
您最好使用“条款和条件”选项(销售->条款和条件)。它会将您想要的任何文本块添加到“审阅”部分,并且要求客户选中该复选框以下订单。考虑到这一点,但不幸的是,客户用于处理信用卡的公司要求复选框位于此处,并且能够在发票上看到该复选框,这是我设置该复选框的方式,只需要找出如何将“是”或“否”插入数据库,然后我就完成了。
class Mage_Payment_Block_Info_Ccsave extends Mage_Payment_Block_Info_Cc
{
/**
* Show name on card, expiration date and full cc number
*
* Expiration date and full number will show up only in secure mode (only for admin, not in emails or pdfs)
*
* @param Varien_Object|array $transport
*/
protected function _prepareSpecificInformation($transport = null)
{
if (null !== $this->_paymentSpecificInformation) {
return $this->_paymentSpecificInformation;
}
$info = $this->getInfo();
$transport = new Varien_Object(array(Mage::helper('payment')->__('Name on the Card') => $info->getCcOwner(),));
$transport = parent::_prepareSpecificInformation($transport);
if (!$this->getIsSecureMode()) {
$transport->addData(array(
Mage::helper('payment')->__('Expiration Date') => $this->_formatCardDate(
$info->getCcExpYear(), $this->getCcExpMonth()
),
Mage::helper('payment')->__('Credit Card Number') => $info->getCcNumber(),
Mage::helper('payment')->__('Authorized to Charge') => $info->getCcCheckbox(),
));
}
return $transport;
}
}
<?php $cc_checkbox = $_GET["cc_checkbox"];
require_once 'app/Mage.php';
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$writeConnection = $resource->getConnection('core_write');
$tableName = $resource->getTableName('sales_flat_order_payment');
if ($cc_checkbox == true) {
$checked="Yes";
$query = "UPDATE INTO {$tableName} (cc_checkbox)
VALUES ('Yes')";
}
else {
$checked="No";
$query = "INSERT INTO {$tableName} (cc_checkbox)
VALUES ('No')";
}
$writeConnection->query($query);
?>