WordPress.org

Plugin Directory

Changeset 1632906


Ignore:
Timestamp:
04/08/17 15:23:00 (3 months ago)
Author:
ahmedkaludi
Message:

0.3 release

Location:
amp-woocommerce
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • amp-woocommerce/tags/0.3/amp-woocommerce.php

    r1632892 r1632906  
    44Description: WooCommerce for AMP (Accelerated Mobile Pages). This plugin enables e-commerce store functionality with WooCommerce for AMP. AMP for Ecommerce out of the box. 
    55Author: Mohammed Kaludi 
    6 Version: 0.2 
     6Version: 0.3 
    77Author URI: http://ampforwp.com 
    88License: GPLv2 or later 
  • amp-woocommerce/trunk/amp-woocommerce.php

    r1580529 r1632906  
    44Description: WooCommerce for AMP (Accelerated Mobile Pages). This plugin enables e-commerce store functionality with WooCommerce for AMP. AMP for Ecommerce out of the box. 
    55Author: Mohammed Kaludi 
    6 Version: 0.2 
     6Version: 0.3 
    77Author URI: http://ampforwp.com 
    88License: GPLv2 or later 
     
    1010*/ 
    1111// Exit if accessed directly. 
    12     if ( ! defined( 'ABSPATH' ) ) exit; 
     12if ( ! defined( 'ABSPATH' ) ) exit; 
    1313// Enable WooCommerce support for AMP 
    14     function amp_woocommerce_add_woocommerce_support() { 
    15  
     14function amp_woocommerce_add_woocommerce_support() { 
    1615        // Check if the dependent plugins are activated, if not, then return. 
    1716        // As there is no use of this plugin, if parent plugins are not activated. 
     
    2019        add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK | EP_PAGES | EP_ROOT ); 
    2120        add_post_type_support( 'product', AMP_QUERY_VAR ); 
    22  
    2321    } 
    2422    add_action( 'amp_init', 'amp_woocommerce_add_woocommerce_support',11); 
    25  
    2623    add_filter( 'amp_post_template_file', 'amp_woocommerce_custom_woocommerce_template', 10, 3 ); 
    2724 
     
    9491 
    9592                    <!--amp-buttons--> 
    96                       <div class="amp-buttons"> 
     93                      <div class="amp-buttons <?php if($get_available_variations[$i]['image_src']) { ?><?php } else { ?>ampwc-noimg-varients<?php } ?>"> 
    9794 
    9895                        <!--attributes div--> 
    9996                          <div class="product-size"> <?php 
    100                             echo 'Varient attributes : '; 
    10197                            for ($j=0; $j<$variant_attr_count ; $j++) { 
    10298                              echo $variant_attr[$j]; 
    103                               echo ' '; 
    10499                            } ?> 
    105100                          </div> 
     
    108103                       <!--amp-img --> 
    109104                         <div class="amp-img"> 
    110  
    111                               <a href="<?php echo trailingslashit(get_permalink()).'?add-to-cart='.$get_available_variations[$i]["variation_id"]; ?>"> 
    112                                 <amp-img src="<?php echo $get_available_variations[$i]['image_src'];?>" height="500" layout="responsive" width="500"> 
    113                                 </amp-img> 
    114                               </a> 
    115  
    116                                  <?php echo $get_available_variations[$i]['price_html'] ?> 
    117                           <!--add-cart --> 
     105<a href="<?php echo trailingslashit(get_permalink()).'?add-to-cart='.$get_available_variations[$i]["variation_id"]; ?>"> 
     106<?php if($get_available_variations[$i]['image_src']) { ?> 
     107<amp-img src="<?php echo $get_available_variations[$i]['image_src'];?>" height="500" layout="responsive" width="500"> 
     108</amp-img> 
     109<?php } else { ?> 
     110<?php } ?></a> 
     111                            <?php echo $get_available_variations[$i]['price_html'] ?> 
    118112                            <div class="add-cart"> 
    119                               <a href="<?php echo trailingslashit(get_permalink()).'?add-to-cart='.$get_available_variations[$i]["variation_id"]; ?>">Add to Cart 
    120                               </a> 
     113                              <a href="<?php echo trailingslashit(get_permalink()).'?add-to-cart='.$get_available_variations[$i]["variation_id"]; ?>">Select</a> 
    121114                            </div> 
    122                           <!-- /.add-cart --> 
    123  
    124115                        </div> 
    125                       <!-- /.amp-img --> 
    126  
    127116                     </div> 
    128                    <!-- /.amp-buttons --> 
    129  
    130               <?php 
    131             } // end of for loop 
    132           ?>                 </div> 
    133                <!-- /.main-container --> 
    134 </div><!-- amp-conatiner --> 
    135         </div><!-- amp-wp-conatiner --> 
    136         <!--end of main div for variant--> 
    137         <div class="cb"></div> 
     117              <?php } ?> 
     118                </div> 
     119 </div>  
     120        </div>  
     121         <div class="cb"></div> 
    138122      </div> 
    139123        <?php }// end of if condition 
    140     echo '</div>' ; 
    141  
    142  
    143     } 
    144  
     124    echo '</div>' ; } 
    145125 
    146126add_action('amp_woocommerce_before_the_content','amp_woocommerce_bfr_content'); 
     
    148128  // end of if condition for variant check 
    149129} // end of amp_woocommerce_bfr_content() 
    150  
    151130 
    152131    // 2. Add Custom Style for WooCommerce Page 
     
    174153 
    175154<?php } ?> 
    176     .amp-wp-meta.amp-woocommerce-add-cart{ 
    177                 display: block; 
    178         } 
    179  
     155.amp-wp-meta.amp-woocommerce-add-cart{ 
     156        display: block; 
     157} 
    180158.amp-wp-article .ampforwp-add-to-cart-button a{ 
    181159color:#fff 
    182160} 
    183  
    184 /*------ raju -styles ------ */ 
    185  
    186 * http://cssreset.com 
    187 */ 
    188161input,select{vertical-align:middle} 
    189162*,*:after,*:before {box-sizing: border-box;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;-ms-box-sizing: border-box;-o-box-sizing: border-box;} 
     
    198171    height:auto; 
    199172    float:left; 
    200     line-height:0;  
     173    line-height:0; 
    201174} 
    202175.amp-img > img{ 
     
    225198} 
    226199 
    227   
     200 
    228201.amp-img { 
    229202  margin-top: 20px; 
    230203} 
    231204.product-size { 
    232   padding-top: 20px; 
    233   text-align: center; 
     205   text-align: center; 
    234206} 
    235207.amp-wp-meta.amp-woocommerce-price { 
     
    255227} 
    256228.amp-wp-content{ 
    257 font-size:13px;  
     229font-size:13px; 
    258230padding:8px 10px; 
    259231} 
     
    288260} 
    289261.amp-woocommerce-meta-info { 
    290     display: inline-block;  
     262    display: inline-block; 
    291263    width: 100%; 
    292264    padding:10px; 
    293265} 
    294266.amp-woocommerce-meta-info .amp-wp-meta{ 
    295     font-size:15px;  
     267    font-size:15px; 
    296268} 
    297269/* responsive styles for mobile */ 
     
    315287} 
    316288.product-size { 
    317   font-size: 11px; 
     289  font-size: 13px; 
    318290} 
    319291.add-cart { 
     
    337309} 
    338310.product-size { 
    339   padding-top: 10px;   
     311  padding-top: 10px; 
    340312} 
    341313 
     
    385357  top: 10px; 
    386358} 
    387 .add-cart { 
    388   font-size: 15px; 
    389   bottom:35px; 
    390 } 
    391 .product-size { 
    392   font-size: 15px; 
    393 } 
    394359.price { 
    395360  font-size: 14px; 
     
    410375.amp-wp-meta.amp-woocommerce-add-cart { 
    411376  float: left; 
    412   text-align: right;  
     377  text-align: right; 
    413378} 
    414379} 
     
    416381color:#fff 
    417382} 
    418         <?php 
    419     } 
    420  
     383.ampwc-noimg-varients .add-cart{ 
     384    position: relative; 
     385    text-align:center; 
     386    bottom: 0; 
     387    right: 0; 
     388} 
     389.ampwc-noimg-varients{ 
     390    display: inline-block; 
     391    margin-bottom: 15px; 
     392} 
     393.ampwc-noimg-varients .product-size{    float: none; 
     394    margin-right: 7px; 
     395    display: block; 
     396    margin-bottom: 30px;} 
     397.ampwc-noimg-varients .amp-img{float:none} 
     398.ampwc-noimg-varients .add-cart a{padding:6px 16px} 
     399<?php } 
    421400    // 3. Add WooCommerce gallery 
    422401    add_action('amp_woocommerce_after_the_content','amp_woocommerce_add_wc_elements_gallery'); 
     
    451430 
    452431    // 4. Add WooCommerce amp-carousel script only if WC galley is available 
    453     add_action('amp_post_template_head','amp_woocommerce_add_amp_carousel_script'); 
    454  
    455     function amp_woocommerce_add_amp_carousel_script() { 
    456         if ( ! function_exists( 'get_gallery_attachment_ids' ) ) { ?> 
     432     add_action('amp_post_template_head','amp_woocommerce_add_amp_carousel_script'); 
     433 
     434     function amp_woocommerce_add_amp_carousel_script() { 
     435        if ( ! function_exists( 'get_gallery_attachment_ids' ) ) { 
     436    ?> 
    457437                <script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script> 
    458438            <?php 
    459         } 
    460     } 
     439        } 
     440     } 
    461441 
    462442    // 5. Remove Default Post Meta from header 
     
    516496        woocommerce_template_single_excerpt(); 
    517497    } 
    518  
  • amp-woocommerce/trunk/readme.txt

    r1580529 r1632906  
    44Donate link: https://www.paypal.me/Kaludi/5 
    55Requires at least: 3.5 
    6 Tested up to: 4.7.1 
    7 Stable tag: 0.2 
     6Tested up to: 4.7.3 
     7Stable tag: 0.3 
    88License: GPLv2 or later 
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    2020 
    2121== Changelog == 
     22= 0.3 (7th April 2017) = 
     23* non img Variants improved 
     24* Product Gallery Carousel 
     25* Featured Image issue fixed 
     26 
    2227= 0.2 = 
    2328* Variants feature added 
  • amp-woocommerce/trunk/templates/amp-woocommerce-meta-info.php

    r1580529 r1632906  
    11<div class="amp-woocommerce-meta-info"> 
    22    <div class="amp-wp-meta amp-woocommerce-price" > 
    3     <?php 
    4     if ( ! function_exists( 'get_price_html' )) { 
    5  
     3    <?php if ( ! function_exists( 'get_price_html' )) { 
    64        global $woocommerce; 
    7  
    85        $amp_product_price  =  $woocommerce->product_factory->get_product()->get_price_html(); 
    96        $context = ''; 
     
    1512                echo "Sorry, this item is not for sale at the moment, please check out more products <a href=" . esc_url( home_url('/shop') ) . "> Here </a> " ; 
    1613        } 
    17     } 
    18  
    19     ?> 
     14    } ?> 
    2015</div> 
    2116 
    22 <?php global $woocommerce;   
    23  
     17<?php global $woocommerce; 
    2418    if ( $amp_product_price && $woocommerce->product_factory->get_product()->product_type !== "variable" )  { ?> 
    25  
    2619        <div class="amp-wp-meta amp-woocommerce-add-cart" > 
    27             <?php 
    28                 global $woocommerce; 
     20            <?php global $woocommerce; 
    2921 
    3022                $add_to_cart_text   =   $woocommerce->product_factory->get_product()->add_to_cart_text(); 
     
    4537           <div class="amp-wp-meta amp-woocommerce-add-cart"><div class="ampforwp-add-to-cart-button"> <a href="#amp-wp-content">Add to cart</a> </div> 
    4638               </div>  
    47     <?php  
    48 } 
    49  
    50  
    51  
    52 ?> 
    53     </div> 
     39    <?php } ?> 
     40</div> 
  • amp-woocommerce/trunk/templates/ampforwp-wc.php

    r1580532 r1632906  
    2424 
    2525    <div class="amp-wp-content featured-image-content"> 
    26             <?php if ( has_post_thumbnail() ) { ?> 
    27                     <?php 
    28                     $thumb_id = get_post_thumbnail_id(); 
    29                     $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'large', true); 
    30                     $thumb_url = $thumb_url_array[0]; 
    31                     ?> 
    32                     <div class="post-featured-img"><amp-img src=<?php echo $thumb_url ?> 
    33                         width=<?php global $redux_builder_amp; echo $redux_builder_amp['enable-single-featured-img-width'] ?> 
    34                         height=<?php echo $redux_builder_amp['enable-single-featured-img-height']?> layout=responsive></amp-img></div> 
    35             <?php }  ?> 
     26<?php 
     27$featured_image = $this->get( 'featured_image' ); 
     28 
     29if ( empty( $featured_image ) ) { 
     30    return; 
     31} 
     32 
     33$amp_html = $featured_image['amp_html']; 
     34$caption = $featured_image['caption']; 
     35?><div class="amp-wp-article-featured-image amp-wp-content featured-image-content"> 
     36 
     37<figure class="amp-wp-article-featured-image wp-caption"> 
     38    <?php echo $amp_html; // amphtml content; no kses ?> 
     39    <?php if ( $caption ) : ?> 
     40        <p class="wp-caption-text"> 
     41            <?php echo wp_kses_data( $caption ); ?> 
     42        </p> 
     43    <?php endif; ?> 
     44</figure> 
     45</div>   
    3646    </div> 
    3747 
     
    8595// $this->load_parts( array( 'footer' ) ); 
    8696?> 
    87  
    8897<?php 
    8998 $this->load_parts( array( 'footer' ) ); 
    9099 do_action( 'amp_post_template_footer', $this ); 
    91100?> 
    92  
    93  
    94101<?php 
    95102// do_action( 'amp_post_template_footer', $this ); 
Note: See TracChangeset for help on using the changeset viewer.