相关疑难解决方法(0)

函数uasort在PHP 5.5和PHP 7.0中的不同行为

在将PHP版本从5.5更改为7.0后,我遇到了Magento 1.8的奇怪行为.这种奇怪的行为是由于工作职能的改变uasort.

源代码:

<?php

$arr = [
    "nominal" => [
        "before" => ["subtotal", "grand_total"],
        "after" => [],
        "_code" => "nominal"
    ],
    "subtotal" => [
        "after" => ["nominal"],
        "before" => ["grand_total", "shipping", "freeshipping", "tax_subtotal", "discount", "tax", "weee"],
        "_code" => "subtotal"
    ],
    "shipping" => [
        "after" => ["subtotal", "freeshipping", "tax_subtotal", "nominal", "weee"],
        "before" => ["grand_total", "discount", "tax_shipping", "tax"],
        "_code" => "shipping"
    ],
    "grand_total" => [
        "after" => ["subtotal", "nominal", "shipping", "freeshipping", "tax_subtotal", "discount", "tax"],
        "before" => [],
        "_code" => "grand_total" …
Run Code Online (Sandbox Code Playgroud)

php magento php-5.5 php-7

11
推荐指数
1
解决办法
3536
查看次数

在保存付款方式之前如何获得报价总额?

我想创建一步结帐,但在结帐页面我有订单审查部分的问题.当我选择付款方式时,例如"货到付款"有5美元额外,或"checkorder"有%4折扣或"信用卡付款"增加订单总额额外.在保存付款方式之前,我需要一种计算折扣的方法.有什么建议吗?

magento magento-1.5

9
推荐指数
1
解决办法
7319
查看次数

PHP中的拓扑排序

我找到了PHP的拓扑排序功能:

资料来源:http://www.calcatraz.com/blog/php-topological-sort-function-384/

function topological_sort($nodeids, $edges) {
    $L = $S = $nodes = array();
    foreach($nodeids as $id) {
        $nodes[$id] = array('in'=>array(), 'out'=>array());
        foreach($edges as $e) {
            if ($id==$e[0]) { $nodes[$id]['out'][]=$e[1]; }
            if ($id==$e[1]) { $nodes[$id]['in'][]=$e[0]; }
        }
    }
    foreach ($nodes as $id=>$n) { if (empty($n['in'])) $S[]=$id; }
    while (!empty($S)) {
        $L[] = $id = array_shift($S);
        foreach($nodes[$id]['out'] as $m) {
            $nodes[$m]['in'] = array_diff($nodes[$m]['in'], array($id));
            if (empty($nodes[$m]['in'])) { $S[] = $m; }
        }
        $nodes[$id]['out'] = array();
    }
    foreach($nodes as $n) …
Run Code Online (Sandbox Code Playgroud)

php algorithm

7
推荐指数
2
解决办法
2092
查看次数

Magento:发票总额的税额计算不正确

我正在运行Magento 1.5.1.0,以前在发票总额的税款计算上遇到问题。尽管对于我的商店中的所有总计而言,该计算都是正确的,但后端发票视图和pdf发票将显示不正确的总计。

错误的显示值和正确的值之间的区别可以在此图片上看到:( 简短版本:小计将包括运费,尽管运费中已包含运费) 。http://i731.photobucket.com/相册/ww318/vitamin6/orderview_fixed.jpg

因此,我将此问题发布在freelancer.com上,并有人设法对其进行了修复。但是,正如我稍后发现的那样,此修复程序无法涵盖所有​​情况-如果订单可以免费送货,则发票小计仍然不正确。这是显示差异的屏幕截图:http : //i731.photobucket.com/albums/ww318/vitamin6/orderview_freeship.jpg

自由职业者编辑了以下文件,以更正错误的税费计算: app \ code \ local \ Mage \ Sales \ Model \ Order \ Invoice \ Total \ Subtotal.php

其中有以下代码:

    if ($invoice->isLast()) {
        $subtotal = $allowedSubtotal;
        $baseSubtotal = $baseAllowedSubtotal;
        $subtotalInclTax = $allowedSubtotalInclTax;
        $baseSubtotalInclTax  = $baseAllowedSubtotalInclTax;
Run Code Online (Sandbox Code Playgroud)

被替换为:

    if ($invoice->isLast()) {
        $subtotal = $allowedSubtotal;
        $baseSubtotal = $baseAllowedSubtotal;
        //$subtotalInclTax = $allowedSubtotalInclTax;
        //$baseSubtotalInclTax  = $baseAllowedSubtotalInclTax;
        $subtotalInclTax = min($allowedSubtotalInclTax, $subtotalInclTax);
        $baseSubtotalInclTax = min($baseAllowedSubtotalInclTax, $baseSubtotalInclTax);
Run Code Online (Sandbox Code Playgroud)

有人能指出我正确的方向吗,我将如何进一步更改文件以使修正适用于免费送货的订单?如果需要,可以提供有关税收设置等的更多详细信息-预先感谢您!

php magento magento-1.5

5
推荐指数
1
解决办法
5765
查看次数

标签 统计

magento ×3

php ×3

magento-1.5 ×2

algorithm ×1

php-5.5 ×1

php-7 ×1