Title: Create link even if API fails (patch)
Last modified: September 1, 2016

---

# Create link even if API fails (patch)

 *  [mfalkvidd](https://wordpress.org/support/users/mfalkvidd/)
 * (@mfalkvidd)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/create-link-even-if-api-fails-patch/)
 * When an item is not available through the Aliexpress affiliate program, I prefer
   to still view the items so my visitors can get what they want.
 * I have applied the following simple patch to show a link even if I can not get
   a commission:
 *     ```
       --- wp_ae_frame.php.orig      2016-05-30 21:34:58.000000000 +0200
       +++ wp_ae_frame.php    2016-06-12 22:04:49.000000000 +0200
       @@ -23,7 +23,7 @@
   
                       $html = "";
                       if(!isset($data['status']) || $data['status'] == 0){
       -                       $html = $this->get_html_no_item();
       +                       $html = $this->get_html_no_item($id);
                       }else{
                               $html = $this->get_html_item($data['item']);
                       }
       @@ -239,13 +239,13 @@
                       return $html;
               }
   
       -       private function get_html_no_item()
       +       private function get_html_no_item($id)
               {
                       $html = "";
   
                       $html .= "<div class='wp_ae_no_item_container'>";
                               $html .= "<div class='wp_ae_no_item_logo'><span class='wp_ae_no_item_logo_color'>Ali</span>Express</div>";
       -                       $html .= "<div class='wp_ae_no_item_error'>Error: Item no longer available or API problems.</div>";
       +                       $html .= "<div class='wp_ae_no_item_error'><a href='http://www.aliexpress.com/af/$id.html'>Buy</a></div>";
                               $html .= "<div class='wp_ae_clear'></div>";
                       $html .= "</div>";
       ```
   
 * [https://wordpress.org/plugins/wp-aliexpress-shortcode/](https://wordpress.org/plugins/wp-aliexpress-shortcode/)

The topic ‘Create link even if API fails (patch)’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-aliexpress-shortcode_df7055.svg)
 * [WP AliExpress Shortcode](https://wordpress.org/plugins/wp-aliexpress-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-aliexpress-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-aliexpress-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-aliexpress-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-aliexpress-shortcode/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [mfalkvidd](https://wordpress.org/support/users/mfalkvidd/)
 * Last activity: [9 years, 12 months ago](https://wordpress.org/support/topic/create-link-even-if-api-fails-patch/)
 * Status: not resolved