예제 #1
0
				</table></td>
			</tr>
			<tr>
				<td></td>
			</tr>
			<tr>
				<td class="main" align="right"><?php 
echo zen_draw_hidden_field('products_date_added', zen_not_null($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d')) . zen_image_submit('button_preview.gif', IMAGE_PREVIEW) . '&nbsp;&nbsp;<a href="' . zen_href_link_admin(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
?>
</td>
			</tr>
			<tr>
				<td><table border="0" cellspacing="0" cellpadding="2">
<?php 
// show when product is linked
if (!empty($_GET['pID']) && zen_get_product_is_linked($_GET['pID']) == 'true') {
    ?>
					<tr>
						<td class="main"><?php 
    echo TEXT_MASTER_CATEGORIES_ID;
    ?>
</td>
						<td class="main">
							<?php 
    // echo zen_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id);
    echo zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '&nbsp;&nbsp;';
    echo zen_draw_pull_down_menu('master_categories_id', zen_get_master_categories_pulldown($_GET['pID']), $pInfo->master_categories_id);
    ?>
						</td>
					</tr>
					<tr>
예제 #2
0
        <td><?php 
echo zen_draw_separator('pixel_trans.gif', '1', '10');
?>
</td>
      </tr>
      <tr>
        <td class="main" align="right"><?php 
echo zen_draw_hidden_field('products_date_added', zen_not_null($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d')) . zen_image_submit('button_preview.gif', IMAGE_PREVIEW) . '&nbsp;&nbsp;<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) && !empty($_GET['search']) ? '&search=' . $_GET['search'] : '') . (isset($_POST['search']) && !empty($_POST['search']) && empty($_GET['search']) ? '&search=' . $_POST['search'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
?>
</td>
      </tr>
      <tr>
        <td><table border="0" cellspacing="0" cellpadding="2">
<?php 
// show when product is linked
if (zen_get_product_is_linked($_GET['pID']) == 'true' and $_GET['pID'] > 0) {
    ?>
          <tr>
            <td class="main"><?php 
    echo TEXT_MASTER_CATEGORIES_ID;
    ?>
</td>
            <td class="main">
              <?php 
    // echo zen_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id);
    echo zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '&nbsp;&nbsp;';
    echo zen_draw_pull_down_menu('master_category', zen_get_master_categories_pulldown($_GET['pID']), $pInfo->master_categories_id);
    ?>
            </td>
          </tr>
<?php 
<?php 
    } else {
        echo zen_draw_form('setflag_products', FILENAME_CATEGORIES, 'action=setflag&pID=' . $products->fields['products_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) && !empty($_GET['search']) ? '&search=' . $_GET['search'] : ''));
        ?>
        <input type="image" src="<?php 
        echo DIR_WS_IMAGES;
        ?>
icon_red_on.gif" title="<?php 
        echo IMAGE_ICON_STATUS_OFF;
        ?>
"/>
        <input type="hidden" name="flag" value="1" />
        </form>
<?php 
    }
    if (zen_get_product_is_linked($products->fields['products_id']) == 'true') {
        echo '&nbsp;&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '<br>';
    }
    ?>
                </td>
<?php 
    if ($action == '') {
        ?>
                <td class="dataTableContent" align="right"><?php 
        echo $products->fields['products_sort_order'];
        ?>
</td>
                <td class="dataTableContent" align="right">
        <?php 
        echo '<a href="' . zen_href_link($type_handler, 'cPath=' . $cPath . '&product_type=' . $products->fields['products_type'] . '&pID=' . $products->fields['products_id'] . '&action=new_product' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>';
        ?>
예제 #4
0
/**
 * Return the number of products in a category
 * TABLES: products, products_to_categories, categories
 * syntax for count: zen_get_products_to_categories($categories->fields['categories_id'], true)
 * syntax for linked products: zen_get_products_to_categories($categories->fields['categories_id'], true, 'products_active')
 */
function zen_get_products_to_categories($category_id, $include_inactive = false, $counts_what = 'products')
{
    global $db;
    $products_count = $cat_products_count = 0;
    $products_linked = '';
    if ($include_inactive == true) {
        switch ($counts_what) {
            case 'products':
                $cat_products_query = "select count(*) as total\n                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                           where p.products_id = p2c.products_id\n                           and p2c.categories_id = '" . (int) $category_id . "'";
                break;
            case 'products_active':
                $cat_products_query = "select p.products_id\n                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                           where p.products_id = p2c.products_id\n                           and p2c.categories_id = '" . (int) $category_id . "'";
                break;
        }
    } else {
        switch ($counts_what) {
            case 'products':
                $cat_products_query = "select count(*) as total\n                             from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                             where p.products_id = p2c.products_id\n                             and p.products_status = 1\n                             and p2c.categories_id = '" . (int) $category_id . "'";
                break;
            case 'products_active':
                $cat_products_query = "select p.products_id\n                             from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                             where p.products_id = p2c.products_id\n                             and p.products_status = 1\n                             and p2c.categories_id = '" . (int) $category_id . "'";
                break;
        }
    }
    $cat_products = $db->Execute($cat_products_query);
    switch ($counts_what) {
        case 'products':
            if (!$cat_products->EOF) {
                $cat_products_count += $cat_products->fields['total'];
            }
            break;
        case 'products_active':
            while (!$cat_products->EOF) {
                if (zen_get_product_is_linked($cat_products->fields['products_id']) == 'true') {
                    return $products_linked = 'true';
                }
                $cat_products->MoveNext();
            }
            break;
    }
    $cat_child_categories_query = "select categories_id\n                               from " . TABLE_CATEGORIES . "\n                               where parent_id = '" . (int) $category_id . "'";
    $cat_child_categories = $db->Execute($cat_child_categories_query);
    if ($cat_child_categories->RecordCount() > 0) {
        while (!$cat_child_categories->EOF) {
            switch ($counts_what) {
                case 'products':
                    $cat_products_count += zen_get_products_to_categories($cat_child_categories->fields['categories_id'], $include_inactive);
                    break;
                case 'products_active':
                    if (zen_get_products_to_categories($cat_child_categories->fields['categories_id'], true, 'products_active') == 'true') {
                        return $products_linked = 'true';
                    }
                    break;
            }
            $cat_child_categories->MoveNext();
        }
    }
    switch ($counts_what) {
        case 'products':
            return $cat_products_count;
            break;
        case 'products_active':
            return $products_linked;
            break;
    }
}
예제 #5
0
    ?>
            </td>
          </tr>

        <tr>
          <td colspan="3">
            <table>

<?php 
    // show when product is linked
    if (zen_get_product_is_linked($products_filter) == 'true') {
        ?>
              <tr>
                <td class="main" align="center" valign="bottom">
                  <?php 
        echo zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '&nbsp;&nbsp;' . TEXT_LEGEND_LINKED . ' ' . zen_get_product_is_linked($products_filter, 'true');
        ?>
                </td>
              </tr>
<?php 
    }
    ?>
              <tr>
                <td class="main" align="center" valign="bottom">
<?php 
    if ($_GET['products_filter'] != '') {
        echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=new_product' . '&cPath=' . $current_category_id . '&pID=' . $products_filter . '&product_type=' . zen_get_products_type($products_filter)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '<br />' . TEXT_PRODUCT_EDIT . '</a>';
        echo '</td><td class="main" align="center" valign="bottom">';
        echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id, 'NONSSL') . '">' . zen_image_button('button_edit_attribs.gif', IMAGE_EDIT_ATTRIBUTES) . '<br />' . TEXT_ATTRIBUTE_EDIT . '</a>' . '&nbsp;&nbsp;&nbsp;';
    }
    ?>
            ?>
</td>
          </tr>
          <tr>
            <td colspan="5" class="main" align="center"><?php 
            echo $action == '' ? '<span class="alert">' . TEXT_INFO_PREVIEW_ONLY . '</span>' : TEXT_INFO_UPDATE_REMINDER;
            ?>
</td>
          </tr>
<?php 
        }
        // master category linked
        ?>

<?php 
        if (zen_get_product_is_linked($products_filter) == 'false' and $pInfo->master_categories_id != zen_get_products_category_id($products_filter)) {
            ?>
          <tr>
<!--- Dual Pricing start --->
            <td colspan="8" class="main"><span class="alert">
<!--- Dual Pricing start --->
              <?php 
            echo sprintf(TEXT_INFO_MASTER_CATEGORIES_ID_WARNING, $pInfo->master_categories_id, zen_get_products_category_id($products_filter));
            ?>
</span>
              <br /><strong><?php 
            echo sprintf(TEXT_INFO_MASTER_CATEGORIES_ID_UPDATE_TO_CURRENT, $pInfo->master_categories_id, zen_get_products_category_id($products_filter));
            ?>
</strong>
            </td>
         </tr>
예제 #7
0
function zen_get_products_to_categories($category_id, $include_inactive = false, $counts_what = 'products')
{
    global $gBitDb;
    $products_count = 0;
    $cat_products_count = 0;
    if ($include_inactive == true) {
        switch ($counts_what) {
            case 'products':
                $cat_products_query = "SELECT count(*) as `total`\n\t\t\t\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE p.`products_id` = p2c.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t and p2c.`categories_id` = '" . (int) $category_id . "'";
                break;
            case 'products_active':
                $cat_products_query = "SELECT p.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE p.`products_id` = p2c.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t and p2c.`categories_id` = '" . (int) $category_id . "'";
                break;
        }
    } else {
        switch ($counts_what) {
            case 'products':
                $cat_products_query = "SELECT count(*) as `total`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE p.`products_id` = p2c.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t and p.`products_status` = '1'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t and p2c.`categories_id` = '" . (int) $category_id . "'";
                break;
            case 'products_active':
                $cat_products_query = "SELECT p.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE p.`products_id` = p2c.`products_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t and p.`products_status` = '1'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t and p2c.`categories_id` = '" . (int) $category_id . "'";
                break;
        }
    }
    $cat_products = $gBitDb->Execute($cat_products_query);
    switch ($counts_what) {
        case 'products':
            $cat_products_count += $cat_products->fields['total'];
            break;
        case 'products_active':
            while (!$cat_products->EOF) {
                if (zen_get_product_is_linked($cat_products->fields['products_id']) == 'true') {
                    return 'true';
                }
                $cat_products->MoveNext();
            }
            break;
    }
    $cat_child_categories_query = "SELECT `categories_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM " . TABLE_CATEGORIES . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE `parent_id` = '" . (int) $category_id . "'";
    $cat_child_categories = $gBitDb->Execute($cat_child_categories_query);
    if ($cat_child_categories->RecordCount() > 0) {
        while (!$cat_child_categories->EOF) {
            switch ($counts_what) {
                case 'products':
                    $cat_products_count += zen_get_products_to_categories($cat_child_categories->fields['categories_id'], $include_inactive);
                    break;
                case 'products_active':
                    if (zen_get_products_to_categories($cat_child_categories->fields['categories_id'], true, 'products_active') == 'true') {
                        return 'true';
                    }
                    break;
            }
            $cat_child_categories->MoveNext();
        }
    }
    switch ($counts_what) {
        case 'products':
            return $cat_products_count;
            break;
        case 'products_active':
            return 'true';
            break;
    }
}