Beispiel #1
0
{
    foreach ($updates as $update) {
        foreach ($update as $src => $dst) {
            $old = br()->db()->getRow('SELECT * FROM br_nested_set WHERE name = ?', $src);
            $new = br()->db()->getRow('SELECT * FROM br_nested_set WHERE name = ?', $src);
            if ($dst) {
                $dstId = br()->db()->getValue('SELECT id FROM br_nested_set WHERE name = ?', $dst);
            } else {
                $dstId = null;
            }
            $new = array('parent_id' => $dstId);
            br()->log('UPDATE parent_id OF ' . $old['id'] . ' FROM ' . $old['parent_id'] . ' TO ' . $new['parent_id']);
            br()->db()->table('br_nested_set')->update($new, $old['id']);
            $nestedSet->processUpdate($old, $new);
            printTree();
            $nestedSet->verify();
        }
    }
}
updates($nestedSet, $updates);
function deletes($nestedSet, $deletes)
{
    foreach ($deletes as $delete) {
        $row = br()->db()->getRow('SELECT * FROM br_nested_set WHERE name = ?', $delete);
        br()->db()->table('br_nested_set')->remove($row['id']);
        $nestedSet->processDelete($row);
        printTree();
        $nestedSet->verify();
    }
}
deletes($nestedSet, $deletes);
Beispiel #2
0
<?php

require_once "UserClass.php";
require_once "generalFunctions.php";
?>
<html> 
	<style type="text/css">  
	    @import url(zivStyle.css);    
	</style>
	<script language="javascript" src="javascripts/javaScriptFunctions.js"></script>
	<head></head>
	<body> 
		<?php 
updates();
drawTodoListForm();
?>
	</body> 
</html> 
<?php 
function updates()
{
    if (isset($_POST[id])) {
        $val = 1 - $_POST[done];
        $sql = "UPDATE todolist Set done='" . $val . "' WHERE id='" . $_POST[id] . "'";
    }
    if (!$_POST["newComment"] == "") {
        $sql = "INSERT INTO todolist(comment) values('" . $_POST["newComment"] . "')";
    }
    executeQuary($sql);
}
function drawTodoListForm()
Beispiel #3
0
require_once 'app/Mage.php';
//Path da class do magento Magento
Mage::app();
$product_sku = '0001';
$product_id = Mage::getModel("catalog/product")->getIdBySku($product_sku);
function delete($sku)
{
}
function create()
{
}
function updates($price, $product_id)
{
    try {
        $product = Mage::getModel('catalog/product');
        $productId = $product_id;
        $product->load($productId);
        if ($product && $product->getId()) {
            $product->setPrice(strval($price));
            $product->save();
            echo 'foi salvo ';
        }
    } catch (Exception $e) {
        Mage::logException($e);
        echo 'fudeu';
    }
    echo 'aeee porra!!!';
}
updates('10,50', $product_id);
if ($acao == 'create') {
    create($nome1, $sku1, $descricao1, $desccurta1, $peso1, $preco1);
}
/*
Exemplo de create
https://consultoria7.com/alimentacao/functions.php?acao=create&nome=Filet Mignon&id=222222&descricao=Corte Alto&desccurta=Estilo Tornedor&peso=2&preco=3100
https://consultoria7.com/alimentacao/functions.php?acao=create&nome=Quibe Frito&id=333333&descricao=Frito em Óleo Vegetal&desccurta=Sem conservantes&peso=1&preco=150
https://consultoria7.com/alimentacao/functions.php?acao=create&nome=Risoto&id=444444&descricao=Ristoto de Calabresa&desccurta=Com alho poró&peso=2000&preco=45.00
*/
/*
Ação de Edição
*/
if ($acao == 'edit') {
    foreach ($product_sku as $sku) {
        $product_id = Mage::getModel("catalog/product")->getIdBySku($sku);
        updates($valores[$i], $product_id);
        $i++;
    }
}
/*
Exemplo de edit
https://consultoria7.com/alimentacao/functions.php?acao=edit&id=222222&preco=31.00
*/
/*
Ação de Delete
*/
if ($acao == 'delete') {
    foreach ($product_delete as $sku) {
        $product_id = Mage::getModel("catalog/product")->getIdBySku($sku);
        deletes($product_id);
    }