예제 #1
0
                } else {
                    if ($error === null) {
                        $error = array();
                    }
                    $error[] = \i18n("Unable to find product %s", PLUGIN_NAME, $tab['Reference']);
                }
                if ($tab['Quantity'] === "0" || intval($tab['Quantity']) !== 0) {
                    $quantityOk = true;
                } else {
                    if ($error === null) {
                        $error = array();
                    }
                    $error[] = \i18n("Undefined quantity for product %s", PLUGIN_NAME, $tab['Reference']);
                }
                if ($productOk && $quantityOk) {
                    echo "setProduct(\"" . \Pasteque\esc_js($product->id) . "\", \"" . \Pasteque\esc_js($product->reference) . "\", " . ($product->hasImage ? "1" : "0") . ", \"" . \Pasteque\esc_js($product->label) . "\", " . $tab['Quantity'] . ");\n";
                }
            }
            echo "});\n";
            echo "</script>\n\n";
            $csv->close();
        }
    }
}
$categories = \Pasteque\CategoriesService::getAll();
$products = \Pasteque\ProductsService::getAll(TRUE);
$locNames = array();
$locIds = array();
foreach ($locations as $location) {
    $locNames[] = $location->label;
    $locIds[] = $location->id;
예제 #2
0
    /** Add all product contain in the category */
    addAllPrd = function() {
        var prdCat = catalog.productsByCategory[catalog.currentCategoryId];
            for (var i = 0; i < prdCat.length; i++) {
                productPicked(prdCat[i]);
            }
    }

</script>

<script type="text/javascript">
<?php 
foreach ($products as $product) {
    echo "registerProduct(\"" . \Pasteque\esc_js($product->id) . "\", \"" . \Pasteque\esc_js($product->label) . "\");\n";
}
if ($composition !== null) {
    foreach ($composition->groups as $group) {
        echo "var id = addSubgroup(\"" . \Pasteque\esc_js($group->label) . "\", " . \Pasteque\esc_js($group->dispOrder) . ");\n";
        foreach ($group->choices as $prod) {
            echo "addProduct(id, \"" . \Pasteque\esc_js($prod->productId) . "\");";
        }
    }
    echo "showSubgroup();\n";
} else {
    echo "addSubgroup(\"\", \"\");\n";
    echo "showSubgroup();\n";
}
?>
</script>
<?php