2.3.x-and-above/upload/catalog/controller/extension/module/facebook_business.php [574:656]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          && $product_info['special_date_start'] != '0000-00-00' && $product_info['special_date_end'] !='0000-00-00') {
            $datetime_start = new DateTime($product_info['special_date_start']);
            $datetime_end = new DateTime($product_info['special_date_end']);
            $special_date_start = $datetime_start->format('Y-m-d') . 'T00:00+00:00';
            $special_date_end = $datetime_end->format('Y-m-d') . 'T23:59+00:00';

            $special_price_period = $special_date_start . '/' . $special_date_end;

            return $this->formatAndTrimString($special_price_period);
        } else {
            return '""';
        }
    }

    public function getAvailability($product_info) {
        if ($product_info['quantity'] <= 0 && $product_info['subtract']) {
            $availability = 'out of stock';
        } else {
            $availability = 'in stock';
        }
    
        return $availability;
    }

    private function getCondition($product_id) {
        $product_to_facebook = $this->model_extension_module_facebook_business->getProductToFacebook($product_id);

        if ($product_to_facebook) {
            if ($product_to_facebook['condition']) {
                return $product_to_facebook['condition'];
            }
        }

        return 'new';
    }

    private function getAdditionalDetails($product_id) {
        $additional_details = array();

        $product_to_facebook = $this->model_extension_module_facebook_business->getProductToFacebook($product_id);

        if ($product_to_facebook) {
            foreach ($product_to_facebook as $key => $value) {
                if ($key == 'google_product_category' || $key == 'condition') {
                    continue;
                } else {
                    if ($value) {
                        $additional_details[$key] = $this->formatAndTrimString($value);
                    } else {
                        $additional_details[$key] = '';
                    }
                }
            }
        }

        return $additional_details;
    }

    public function getProductInfoForFacebookPixel() {
        $event_name = (isset($this->request->get['event_name']))
          ? $this->request->get['event_name']
          : '';

        /**
         * Creating a default facebook_pixel_params with just the event_name
         * and empty parameters. This is to guard against cases where the
         * product is not found or the product_id is not available.
         */
        $facebook_pixel_event_params = array('event_name' => $event_name);

        if (isset($this->request->get['product_id']) && $this->request->get['product_id']) {
            $this->load->model('catalog/product');
            $this->load->model('extension/module/facebook_business');

            $product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);

            if ($product_info) {
                $quantity = isset($this->request->get['quantity']) ? $this->request->get['quantity'] : 1;

                $contents = array(
                    'id'        => $product_info['product_id'],
                    'quantity'  => $quantity
                );
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



3.0.x-and-above/upload/catalog/controller/extension/module/facebook_business.php [576:658]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          && $product_info['special_date_start'] != '0000-00-00' && $product_info['special_date_end'] !='0000-00-00') {
            $datetime_start = new DateTime($product_info['special_date_start']);
            $datetime_end = new DateTime($product_info['special_date_end']);
            $special_date_start = $datetime_start->format('Y-m-d') . 'T00:00+00:00';
            $special_date_end = $datetime_end->format('Y-m-d') . 'T23:59+00:00';

            $special_price_period = $special_date_start . '/' . $special_date_end;

            return $this->formatAndTrimString($special_price_period);
        } else {
            return '""';
        }
    }

    public function getAvailability($product_info) {
        if ($product_info['quantity'] <= 0 && $product_info['subtract']) {
            $availability = 'out of stock';
        } else {
            $availability = 'in stock';
        }
    
        return $availability;
    }

    private function getCondition($product_id) {
        $product_to_facebook = $this->model_extension_module_facebook_business->getProductToFacebook($product_id);

        if ($product_to_facebook) {
            if ($product_to_facebook['condition']) {
                return $product_to_facebook['condition'];
            }
        }

        return 'new';
    }

    private function getAdditionalDetails($product_id) {
        $additional_details = array();

        $product_to_facebook = $this->model_extension_module_facebook_business->getProductToFacebook($product_id);

        if ($product_to_facebook) {
            foreach ($product_to_facebook as $key => $value) {
                if ($key == 'google_product_category' || $key == 'condition') {
                    continue;
                } else {
                    if ($value) {
                        $additional_details[$key] = $this->formatAndTrimString($value);
                    } else {
                        $additional_details[$key] = '';
                    }
                }
            }
        }

        return $additional_details;
    }

    public function getProductInfoForFacebookPixel() {
        $event_name = (isset($this->request->get['event_name']))
          ? $this->request->get['event_name']
          : '';

        /**
         * Creating a default facebook_pixel_params with just the event_name
         * and empty parameters. This is to guard against cases where the
         * product is not found or the product_id is not available.
         */
        $facebook_pixel_event_params = array('event_name' => $event_name);

        if (isset($this->request->get['product_id']) && $this->request->get['product_id']) {
            $this->load->model('catalog/product');
            $this->load->model('extension/module/facebook_business');

            $product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);

            if ($product_info) {
                $quantity = isset($this->request->get['quantity']) ? $this->request->get['quantity'] : 1;

                $contents = array(
                    'id'        => $product_info['product_id'],
                    'quantity'  => $quantity
                );
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



