Example #1
0
        $num = count($data);
        echo "<p> {$num} fields in line {$row}: <br /></p>\n";
        $row++;
        // Skip title rows
        if ($row < 4) {
            continue;
        }
        echo "Create Product: " . $data[0] . "<br/>";
        $product_id = create_product($data[0], '0');
        if (!$product_id) {
            $product = get_product_by_name($data[0]);
            $product_id = $product['productid'];
        }
        for ($i = 1; $i <= 10; $i++) {
            $bag_id = $bag_ids[$i];
            $quantity = $data[$i];
            $choice = $data[11] == 'Y' ? '1' : '0';
            if ($quantity != '') {
                echo "Bag Name: " . $bag_names[$i] . " | BagID: " . $bag_id . " | Quantity: " . $quantity . "<br/>";
                create_bag_content($bag_id, $product_id, $quantity, $choice, '');
            }
        }
        /*
        		for ($c=0; $c < $num; $c++) {
                    echo $data[$c] . "<br />\n";
                }*/
    }
    fclose($handle);
}
?>
</pre>
Example #2
0
             case 'save':
                 edit_bag_content(post('bid'), post('pid'), post('quantity'), post('choice'), post('notes'));
                 //print_r($_POST);
                 exit;
                 break;
             case 'delete':
                 delete_bag_content(post('bagid'), post('productid'));
                 exit;
                 break;
             case 'add':
                 $product = get_product_by_name(post('product_name'));
                 if (!isset($product['productid'])) {
                     echo "NOT_SET";
                 } else {
                     echo "SET";
                     create_bag_content(post('bagid'), $product['productid'], "0", '0', "");
                 }
                 exit;
                 break;
             default:
                 redirect($g["abs_url"] . '/error/invalid-page');
         }
     } else {
         redirect($g["abs_url"] . '/error/invalid-page');
     }
     break;
 case 'bag':
     if (isset($action_command)) {
         switch ($action_command) {
             case 'new':
                 create_bag(post('name'));
Example #3
0
/** import bag information from csv version of the excel bag contents
 */
function import_bag_content($bagid, $name, $quantity, $notes, $choice)
{
    // Create product in inventory
    $productid = create_product($name, '');
    if (!$productid) {
        $product = get_product_by_name($name);
        $productid = $product['productid'];
    }
    echo "bag: " . $bagid . " product: " . $productid . " <br/>";
    create_bag_content($bagid, $productid, $quantity, $choice, $notes);
}