protected function do_actions()
 {
     if (isset($_GET['product_id'])) {
         if (isset($_GET['photograph_id'])) {
             Shop_ProductsHelper::disassociate_product_photo($_GET['product_id'], $_GET['photograph_id']);
         }
         $this->set_return_to_url(Shop_ProductsHelper::get_admin_edit_product_page_url($_GET['product_id']));
     } else {
         $this->set_return_to_url(Shop_ProductsHelper::get_admin_products_page_url());
     }
     #print_r($this); exit;
 }
 public static function reset_products()
 {
     Database_TableHelper::empty_table('hpi_trackit_stock_management_products');
     Shop_ProductsHelper::delete_all_products();
     TrackitStockManagement_FeedFilesHelper::reset_product_files_processed_status();
 }
 public function get_extra_photograph_form_checkbox_li()
 {
     $product = $this->get_element();
     $input_li = new HTMLTags_LI();
     $input_label = new HTMLTags_Label('Extra Photographs');
     $input_label->set_attribute_str('for', 'extra_photograph_id');
     $input_li->append_tag_to_content($input_label);
     /*
      * Link to add an extra photograph.
      */
     $add_extra_photograph_a = new HTMLTags_A('Add an extra Photograph');
     $add_extra_photograph_a->set_attribute_str('class', 'cool_button set_image_button');
     $add_extra_photograph_url = new HTMLTags_URL();
     $add_extra_photograph_url->set_file('/haddock/public-html/public-html/index.php');
     $add_extra_photograph_url->set_get_variable('oo-page');
     $add_extra_photograph_url->set_get_variable('page-class', 'Shop_AdminProductsPage');
     $add_extra_photograph_url->set_get_variable('add_extra_photograph');
     $add_extra_photograph_url->set_get_variable('product_id', $product->get_id());
     $add_extra_photograph_a->set_href($add_extra_photograph_url);
     $input_li->append_tag_to_content($add_extra_photograph_a);
     $epul = new HTMLTags_UL();
     $extra_photographs = $product->get_extra_photographs();
     #$database = $product->get_database();
     #$photographs_table = $database->get_table('hpi_shop_photographs');
     #$photographs = $photographs_table->get_all_rows();
     #
     #foreach ($photographs as $photograph)
     #{
     #	$photograph_renderer = $photograph->get_renderer();
     #	$input = new HTMLTags_Input();
     #	$input->set_attribute_str('type', 'checkbox');
     #	$input->set_attribute_str('name', 'extra_photograph_id_' . $photograph->get_id());
     #	$input->set_value($photograph->get_id());
     #
     #	foreach ($extra_photographs as $extra_photograph)
     #	{
     #		if ($extra_photograph->get_id() == $photograph->get_id())
     #		{
     #			$input->set_attribute_str('checked', 'checked');
     #		}
     #	}
     #
     #	$input_li->append_tag_to_content($input);
     #	$input_li->append_tag_to_content($photograph_renderer->get_thumbnail_img());
     #}
     foreach ($extra_photographs as $ep) {
         $epli = new HTMLTags_LI();
         $epr = $ep->get_renderer();
         $tbia = $epr->get_thumbnail_image_a();
         $epli->append_tag_to_content($tbia);
         $delete_extra_photo_url = Shop_ProductsHelper::get_admin_disassociate_product_photo_redirect_script_url($product->get_id(), $ep->get_id());
         $delete_extra_photo_a = new HTMLTags_A('Delete');
         $delete_extra_photo_a->set_href($delete_extra_photo_url);
         $epli->append_tag_to_content($delete_extra_photo_a);
         $epul->add_li($epli);
     }
     $input_li->append_tag_to_content($epul);
     $input_msg_box = new HTMLTags_Span();
     $input_msg_box->set_attribute_str('id', 'extra_photograph_id' . 'msg');
     $input_msg_box->set_attribute_str('class', 'rules');
     $input_li->append_tag_to_content($input_msg_box);
     return $input_li;
 }
        if (isset($_POST[$principal_tag->get_id()])) {
            $product->add_tag($principal_tag);
        }
    }
    $return_to_url->set_get_variable('last_edited_id', $_GET['product_id']);
}
if (isset($_GET['set_stock_level']) && isset($_GET['product_id'])) {
    $product = $products_table->get_row_by_id($_GET['product_id']);
    $product->set_stock_level_and_stock_buffer_level($_POST['stock_level'], $_POST['stock_buffer_level']);
    //    $return_to .= '&last_edited_id=' . $_GET['edit_id'];
    $return_to_url->set_get_variable('last_edited_id', $_GET['product_id']);
}
if (isset($_GET['toggle_status']) && isset($_GET['product_id'])) {
    $product = $products_table->get_row_by_id($_GET['product_id']);
    //                $product->toggle_status();
    Shop_ProductsHelper::toggle_status_for_all_products_with_this_products_style_id($product);
    //    $return_to .= '&last_edited_id=' . $_GET['edit_id'];
    $return_to_url->set_get_variable('last_edited_id', $_GET['product_id']);
}
if (isset($_GET['product_category_id'])) {
    $return_to_url->set_get_variable('product_category_id', $_GET['product_category_id']);
}
if (isset($_GET['set_main_photograph']) && isset($_GET['product_id']) && isset($_GET['photograph_id'])) {
    $dbh = $database->get_database_handle();
    $product_id = $_GET['product_id'];
    $photograph_id = $_GET['photograph_id'];
    $query = <<<SQL
SELECT
\tid
FROM
\thpi_shop_product_photograph_links