2.3.x-and-above/upload/admin/controller/extension/module/facebook_business.php [340:422]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            'children' => array()
        );

        array_unshift($data['menus'], $facebook_business_menu);
    }

    public function eventPreViewCatalogProductForm($route, &$data) {
        $data = array_merge($this->load->controller('extension/module/facebook_business/productPage'), $data);
    }

    public function eventPostModelAddProduct($route, &$args, $product_id) {
        $data = $args[0];

        if (isset($data['facebook_google_product_category']) && isset($data['facebook_condition']) && isset($data['facebook_age_group']) && isset($data['facebook_color']) && isset($data['facebook_gender']) && isset($data['facebook_material']) && isset($data['facebook_pattern'])) {
            $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_facebook WHERE product_id = '" . (int)$product_id . "'");
            $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_facebook SET product_id = '" . (int)$product_id . "', google_product_category = '" . (int)$data['facebook_google_product_category'] . "', `condition` = '" . $this->db->escape($data['facebook_condition']) . "', age_group = '" . $this->db->escape($data['facebook_age_group']) . "', color = '" . $this->db->escape($data['facebook_color']) . "', gender = '" . $this->db->escape($data['facebook_gender']) . "', material = '" . $this->db->escape($data['facebook_material']) . "', pattern = '" . $this->db->escape($data['facebook_pattern']) . "'");
        }
    }

    public function eventPostModelCopyProduct($route, &$args, $test) {
        $product_id = $args[0];

        $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_to_facebook` WHERE product_id = '" . (int)$product_id . "'");

        if ($query->num_rows) {
            $facebook_params = array(
                'facebook_google_product_category'   => $query->row['google_product_category'],
                'facebook_condition'                 => $query->row['condition'],
                'facebook_age_group'                 => $query->row['age_group'],
                'facebook_color'                     => $query->row['color'],
                'facebook_gender'                    => $query->row['gender'],
                'facebook_material'                  => $query->row['material'],
                'facebook_pattern'                   => $query->row['pattern']
            );
        } else {
            $facebook_params = array(
                'facebook_google_product_category'   => '',
                'facebook_condition'                 => '',
                'facebook_age_group'                 => '',
                'facebook_color'                     => '',
                'facebook_gender'                    => '',
                'facebook_material'                  => '',
                'facebook_pattern'                   => ''
            );
        }

        $last_id_query = $this->db->query("SELECT MAX(product_id) AS `product_id` FROM " . DB_PREFIX . "product");

        if ($last_id_query->row['product_id']) {
            $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_facebook SET product_id = '" . (int)$last_id_query->row['product_id'] . "', google_product_category = '" . (int)$facebook_params['facebook_google_product_category'] . "', `condition` = '" . $this->db->escape($facebook_params['facebook_condition']) . "', age_group = '" . $this->db->escape($facebook_params['facebook_age_group']) . "', color = '" . $this->db->escape($facebook_params['facebook_color']) . "', gender = '" . $this->db->escape($facebook_params['facebook_gender']) . "', material = '" . $this->db->escape($facebook_params['facebook_material']) . "', pattern = '" . $this->db->escape($facebook_params['facebook_pattern']) . "'");
        }
    }

    public function eventPostModelEditProduct($route, &$args) {
        $product_id = $args[0];
        $data = $args[1];

        $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_facebook WHERE product_id = '" . (int)$product_id . "'");
        $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_facebook SET product_id = '" . (int)$product_id . "', google_product_category = '" . (int)$data['facebook_google_product_category'] . "', `condition` = '" . $this->db->escape($data['facebook_condition']) . "', age_group = '" . $this->db->escape($data['facebook_age_group']) . "', color = '" . $this->db->escape($data['facebook_color']) . "', gender = '" . $this->db->escape($data['facebook_gender']) . "', material = '" . $this->db->escape($data['facebook_material']) . "', pattern = '" . $this->db->escape($data['facebook_pattern']) . "'");
    }

    public function eventPostModelDeleteProduct($route, &$args) {
        $product_id = $args[0];

        $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_facebook WHERE product_id = '" . (int)$product_id . "'");
    }

    private function clearProductFeed() {
        $feed_file_dir = '';

        if (is_writable(DIR_DOWNLOAD)) {
            $feed_file_dir = DIR_DOWNLOAD;
        } elseif (is_writable(DIR_MODIFICATION)) {
            $feed_file_dir = DIR_MODIFICATION;
        } elseif (is_writable(DIR_LOGS)) {
            $feed_file_dir = DIR_LOGS;
        }

        if ($feed_file_dir) {
            $product_feed_path = $feed_file_dir . 'fbe_product_catalog.csv';

            if (is_file($product_feed_path)) {
                unlink($product_feed_path);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



3.0.x-and-above/upload/admin/controller/extension/module/facebook_business.php [346:428]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            'children' => array()
        );

        array_unshift($data['menus'], $facebook_business_menu);
    }

    public function eventPreViewCatalogProductForm($route, &$data) {
        $data = array_merge($this->load->controller('extension/module/facebook_business/productPage'), $data);
    }

    public function eventPostModelAddProduct($route, &$args, $product_id) {
        $data = $args[0];

        if (isset($data['facebook_google_product_category']) && isset($data['facebook_condition']) && isset($data['facebook_age_group']) && isset($data['facebook_color']) && isset($data['facebook_gender']) && isset($data['facebook_material']) && isset($data['facebook_pattern'])) {
            $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_facebook WHERE product_id = '" . (int)$product_id . "'");
            $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_facebook SET product_id = '" . (int)$product_id . "', google_product_category = '" . (int)$data['facebook_google_product_category'] . "', `condition` = '" . $this->db->escape($data['facebook_condition']) . "', age_group = '" . $this->db->escape($data['facebook_age_group']) . "', color = '" . $this->db->escape($data['facebook_color']) . "', gender = '" . $this->db->escape($data['facebook_gender']) . "', material = '" . $this->db->escape($data['facebook_material']) . "', pattern = '" . $this->db->escape($data['facebook_pattern']) . "'");
        }
    }

    public function eventPostModelCopyProduct($route, &$args, $test) {
        $product_id = $args[0];

        $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_to_facebook` WHERE product_id = '" . (int)$product_id . "'");

        if ($query->num_rows) {
            $facebook_params = array(
                'facebook_google_product_category'   => $query->row['google_product_category'],
                'facebook_condition'                 => $query->row['condition'],
                'facebook_age_group'                 => $query->row['age_group'],
                'facebook_color'                     => $query->row['color'],
                'facebook_gender'                    => $query->row['gender'],
                'facebook_material'                  => $query->row['material'],
                'facebook_pattern'                   => $query->row['pattern']
            );
        } else {
            $facebook_params = array(
                'facebook_google_product_category'   => '',
                'facebook_condition'                 => '',
                'facebook_age_group'                 => '',
                'facebook_color'                     => '',
                'facebook_gender'                    => '',
                'facebook_material'                  => '',
                'facebook_pattern'                   => ''
            );
        }

        $last_id_query = $this->db->query("SELECT MAX(product_id) AS `product_id` FROM " . DB_PREFIX . "product");

        if ($last_id_query->row['product_id']) {
            $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_facebook SET product_id = '" . (int)$last_id_query->row['product_id'] . "', google_product_category = '" . (int)$facebook_params['facebook_google_product_category'] . "', `condition` = '" . $this->db->escape($facebook_params['facebook_condition']) . "', age_group = '" . $this->db->escape($facebook_params['facebook_age_group']) . "', color = '" . $this->db->escape($facebook_params['facebook_color']) . "', gender = '" . $this->db->escape($facebook_params['facebook_gender']) . "', material = '" . $this->db->escape($facebook_params['facebook_material']) . "', pattern = '" . $this->db->escape($facebook_params['facebook_pattern']) . "'");
        }
    }

    public function eventPostModelEditProduct($route, &$args) {
        $product_id = $args[0];
        $data = $args[1];

        $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_facebook WHERE product_id = '" . (int)$product_id . "'");
        $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_facebook SET product_id = '" . (int)$product_id . "', google_product_category = '" . (int)$data['facebook_google_product_category'] . "', `condition` = '" . $this->db->escape($data['facebook_condition']) . "', age_group = '" . $this->db->escape($data['facebook_age_group']) . "', color = '" . $this->db->escape($data['facebook_color']) . "', gender = '" . $this->db->escape($data['facebook_gender']) . "', material = '" . $this->db->escape($data['facebook_material']) . "', pattern = '" . $this->db->escape($data['facebook_pattern']) . "'");
    }

    public function eventPostModelDeleteProduct($route, &$args) {
        $product_id = $args[0];

        $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_facebook WHERE product_id = '" . (int)$product_id . "'");
    }

    private function clearProductFeed() {
        $feed_file_dir = '';

        if (is_writable(DIR_DOWNLOAD)) {
            $feed_file_dir = DIR_DOWNLOAD;
        } elseif (is_writable(DIR_MODIFICATION)) {
            $feed_file_dir = DIR_MODIFICATION;
        } elseif (is_writable(DIR_LOGS)) {
            $feed_file_dir = DIR_LOGS;
        }

        if ($feed_file_dir) {
            $product_feed_path = $feed_file_dir . 'fbe_product_catalog.csv';

            if (is_file($product_feed_path)) {
                unlink($product_feed_path);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



