Jump to content

availability span problem in official theme of ps1.6.0.9. bug?


josias

Recommended Posts

Hi,
Im trying to move the availability span from the original theme to another place (I dont like just below text description, I want in the right column, near the buttons to purchase).

 

For this Inside product-list.tpl file I moved:

                                    {if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                        {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
                            <span itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="availability">
                                {if ($product.allow_oosp || $product.quantity > 0)}
                                    <span class="{if $product.quantity <= 0 && !$product.allow_oosp}out-of-stock{else}available-now{/if}">
                                        <link itemprop="availability" href="http://schema.org/InStock" />{if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}
                                    </span>
                                {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
                                    <span class="available-dif">
                                        <link itemprop="availability" href="http://schema.org/LimitedAvailability" />{l s='Product available with different options'}
                                    </span>
                                {else}
                                    <span class="out-of-stock">
                                        <link itemprop="availability" href="http://schema.org/OutOfStock" />{l s='Out of stock'}
                                    </span>
                                {/if}
                            </span>
                        {/if}
                    {/if}



To Just after:

<div class="button-container">

Result: buttom appers in the place I want but.. still appearing in the previous place!. I have duplicated availability info

 

After many tests I founded the origin of the problem (yes, I moved the code with cut/paste, no copy/paste):

inside the file global.js If I remove the sentence:
 

                    var availability = $(element).find('.availability').html();    // check : catalog mode is enabled
                    if (availability != null) {
                        html += '<span class="availability">'+ availability +'</span>';
                    }

duplicated item dissapear. and all is perfect

Why the line of global.js? is it a mistake?

If not removing the sentence of global.js, no way to dont duplicate the content.

 

Thank you in advance

 

 

Link to comment
Share on other sites

×
×
  • Create New...