コード例 #1
0
/**
 *  This pipeline is called each time after something is inserted to database
 */
function ecatalogue_post_insertion($flux)
{
    // Article inserted
    if ($flux['args']['table'] == 'spip_articles') {
        $id_article = $flux['args']['id_objet'];
        $id_rubrique = $flux['data']['id_rubrique'];
        insert_product($id_article, $id_rubrique);
    }
    return $flux;
}
コード例 #2
0
ファイル: index.php プロジェクト: bdeske/WEB289_project
     } else {
         // include_once ('home.php');
     }
     break;
 case 'go_to_cart':
     include 'cart.php';
     break;
 case 'insert_product':
     $productID = filter_input(INPUT_POST, 'ProductID');
     $catID = filter_input(INPUT_POST, 'CatID');
     $plantname = filter_input(INPUT_POST, 'Plant_Name');
     $description = filter_input(INPUT_POST, 'Description');
     $size = filter_input(INPUT_POST, 'Size');
     $instock = filter_input(INPUT_POST, 'In_Stock');
     $price = filter_input(INPUT_POST, 'Price');
     $products = insert_product($productID, $catID, $plantname, $description, $size, $instock, $price);
     include 'view/insert_product.php';
     break;
 case 'insert_product_B':
     $productID = filter_input(INPUT_POST, 'ProductID');
     $catID = filter_input(INPUT_POST, 'CatID');
     $plantname = filter_input(INPUT_POST, 'Plant_Name');
     $description = filter_input(INPUT_POST, 'Description');
     $size = filter_input(INPUT_POST, 'Size');
     $instock = filter_input(INPUT_POST, 'In_Stock');
     $products = insert_product_B($productID, $catID, $plantname, $description, $size, $instock);
     include 'view/insert_product_B.php';
     break;
 case 'update_products':
     $products = get_products();
     $productID = filter_input(INPUT_POST, 'ProductID');
コード例 #3
0
ファイル: control.php プロジェクト: nickyudha/spalosophy
<?php

include "get.php";
include "update.php";
/* variable */
// Category
$all_category = get_all_category();
// Size Group
$all_size_group = get_all_size_group();
// Color
$all_color_group = get_all_color_group();
/* function database */
if ($_POST["btn-product-detail"] == 'Save Changes' || $_POST["btn-product-detail"] == 'Save Changes & Exit') {
    insert_product();
} else {
    $data = get_product_details();
}
コード例 #4
0
<?php

/**
 * Index.php
 *
 * PHP Version 5
 *
 * @category Ondex
 * @package  MyPackage
 * @author   Nikolskiy Serhiy <*****@*****.**>
 * @license  http://www.gnu.org/copyleft/gpl.html GNU General Public License
 * @link     http://www.hashbangcode.com/
 */
insert_product($name, $type, $price, $description, $logo);
$id = select("products", "name='{$name}' LIMIT 1", "id");
foreach ($_FILES['photos']['name'] as $key => $value) {
    insert_images($id[0]['id'], $value);
}
コード例 #5
0
function clone_product($fm, $product)
{
    $is_single = true;
    $option = array();
    #get all option parsed
    foreach ($product->getProductOptionsCollection() as $o) {
        #Option
        //echo "<br/>Found options for $fm[productName] (<a href='$fm[productUrl]' target='_blank'>Show</a>)<br />Options are: ".$o->getData('default_title');
        $option_title = $o->getData('default_title');
        if (stripos($option_title, 'frame size') !== false) {
            $option_type = 'size';
        } else {
            $option_type = 'add_title';
        }
        $values = $o->getValues();
        foreach ($values as $k => $v) {
            $option_line = array();
            #Values for option
            $option_value = $v->getData('default_title');
            /*	
            	echo "<pre>";
            	echo "SKU: $fm[sku]<br />";
            	echo "price: $fm[productPrice]<br />";
            	print_r($v->debug());
            	echo "</pre>";
            */
            //$debug = $v->debug();
            #Check the product option out of stock?
            if (stripos($option_value, "**out of") !== false) {
                $option_line['stockQuantity'] = 0;
                $option_line['availability'] = 'out of stock';
            } else {
                $option_line['stockQuantity'] = $fm['stockQuantity'];
                $option_line['availability'] = 'in stock';
            }
            $option_line['add_sku'] = $k;
            $option_line['add_title'] = $option_value;
            $option_line['price'] = $v->default_price;
            //$option_line['price'] = $option_line['price'];
            //echo "SKU $fm[sku] price: $fm[productPrice]<br />";
            //echo "<br />price on $k is $option_line[price], v: {$v->default_price} {$debug[default_price]}<br />";
            if ($fm['productPrice'] == 0 && $option_line['price'] == 0) {
                continue;
            }
            $option[$option_type][] = $option_line;
        }
        if ($is_single) {
            $is_single = false;
        }
    }
    /*
    	echo "<br />";
    	echo "$sku";
    	echo "<pre>";
    	print_r($option);
    	echo "</pre>"; */
    #Now we collected all the options, let's make the variants with combination
    if (!$is_single) {
        #Create variants by combine all the variants together
        unset($fm_variants);
        $fm_variants = array();
        $fm_mod = array();
        combine_product($option, $fm_mod, $fm_variants);
        #$fm_variants
        $fmo = $fm;
        $first_variant = true;
        foreach ($fm_variants as $variant) {
            $fm = $fmo;
            #Override the parent data
            if (!$first_variant) {
                $fm['productId'] .= "_" . $variant['add_sku'];
            }
            $first_variant = false;
            $fm['productName'] .= " - " . $variant['add_title'];
            $fm['stockQuantity'] = $variant['stockQuantity'];
            $fm['availability'] = $variant['availability'];
            $fm['sku'] .= "-" . $variant['add_sku'];
            $fm['productPrice'] += $variant['price'];
            $fm['productColour'] = $variant['colour'];
            $fm['productSize'] = $variant['size'];
            $fm['parentId'] = $fmo['sku'];
            #insert new child into stdio
            if ($fm[productPrice] < 1) {
                continue;
            }
            insert_product($fm);
        }
    }
    return $is_single;
}