Post by ahimanshu » Mon Sep 21, 2020 7:09 pm

Hello friends i am new i found a XML code from internet can any one suggest this is compatible for opencart Version 3.0.3.3?

Code: Select all

<file path="catalog/controller/product/product.php">
        <operation info="Count the reviews value">
            <search>
                <![CDATA[$data['tab_review'] = sprintf($this->language->get('tab_review'), $product_info['reviews']); ]]> 
            </search>
            <add position="after">
                <![CDATA[ //custom var for counting reviews
                          $data['count_reviews']  = $product_info['reviews']; 
                    ]]>                     
            </add>
        </operation>

        <operation info="Price And Currency Value">
            <search><![CDATA[           if ((float)$product_info['special']) {]]> </search>
            <add position="before">
                <![CDATA[ //custom filter price value
                          $data['price_val']   =  preg_replace('/[^0-9.]/', '',  $data['price']); 
                          $data['currency_code'] = $this->session->data['currency']; 
                    ]]>                     
            </add>
        </operation>

        <operation info="Special price value">
            <search><![CDATA[           $discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);]]>
            </search>
            <add position="before">
                <![CDATA[ //custom filter special price value           
                          $data['price_special_val']   =  preg_replace('/[^0-9.]/', '',  $data['special']);]]>                  
            </add>
        </operation>
     </file>

     <file path="catalog/view/theme/*/template/product/product.twig">
        <operation>
            <search>
                <![CDATA[ <ul class="breadcrumb">]]>
            </search>
            <add position="replace" offset="4">
                <![CDATA[  <ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">
                            {% set i = 0 %}
                            {% for breadcrumb in breadcrumbs %}
                            <li {% if loop.first == false %} itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" {% endif %} >
                                <a  itemprop="item"   href="{{ breadcrumb.href }}"> 
                   <span {% if loop.first == false  %} itemprop="name" {% endif %}>{{ breadcrumb.text }}</span> </a>
                            {% if loop.first == false  %} <meta itemprop="position" content="{{ i }}" /> {% endif %} 
                            </li> 
                            {% set i=i+1 %}
                            {% endfor %}
                          </ul>]]>
            </add>
        </operation>

        <operation>
            <search>
                <![CDATA[<div id="content" class="{{ class }}">{{ content_top }}]]>
            </search>
            <add position="before">
                <![CDATA[<div itemscope itemtype="https://schema.org/Product">]]>
            </add>
        </operation>

        <operation>
            <search>
                <![CDATA[                <img src="{{ thumb }}" title="{{ heading_title }}" alt="{{ heading_title }}" />]]>
            </search>
            <add position="replace">
                <![CDATA[<img src="{{ thumb }}" itemprop="image"  title="{{ heading_title }}" alt="{{ heading_title }}" />]]>
            </add>
        </operation>

        <operation>
            <search>
                <![CDATA[            <div class="tab-pane active" id="tab-description">{{ description }}</div>]]>
            </search>
            <add position="replace">
                <![CDATA[<div class="tab-pane active" id="tab-description" itemprop="description" > {{description }}</div>]]>
            </add>
        </operation>

        <operation>
            <search>
                <![CDATA[          <h1>{{ heading_title }}</h1>]]>
            </search>
            <add position="replace">
                <![CDATA[
                        <span itemprop="sku" style="display:none;">{{ model }}</span>
                        <h1 itemprop="name" >{{ heading_title }}</h1>
                        <span itemprop="brand" style="display:none;"> {{ manufacturer }} </span>
                        <div itemprop="offers" itemscope itemtype="http://schema.org/Offer"> 
                          <span itemprop="url" style="display:none;">{{ share }} </span>

                          <span itemprop="priceValidUntil" style="display:none;">{{ "now"|date_modify("6 month")|date('Y-m-d' ) }}</span>
                        ]]>
            </add>
        </operation>

        <operation>
            <search>
                <![CDATA[            <li>{{ text_stock }} {{ stock }}</li>]]>
            </search>
            <add position="before">
                <![CDATA[ {% if stock == 'In Stock' %} 
                             <link itemprop="availability" href="http://schema.org/InStock" > 
                          {% else %}   
                            <link itemprop="availability" href="http://schema.org/OutOfStock" >   
                          {% endif %}]]>
            </add>
        </operation>

        <operation>
            <search>
                <![CDATA[          {% if price %}]]>
            </search>
            <add position="replace" offset="10">
                <![CDATA[ {% if price %}
                           <span itemprop="priceCurrency" style="display:none;">{{ currency_code }}</span>
                            <ul class="list-unstyled">
                              {% if not special %}
                               <li> 
                                 <span itemprop="price" style="display:none;">  {{ price_val }}</span>
                                 <h2>{{ price }} </h2>
                               </li>
                              {% else %}
                                <li><span style="text-decoration: line-through;">{{ price }}</span></li>
                                  <li>
                                    <span style="display:none;" itemprop="price">{{ price_special_val }}</span>
                                    <h2 >{{ special }}</h2>
                                  </li>]]>
            </add>
        </operation>

        <operation>
            <search>
                <![CDATA[            {% for discount in discounts %}]]>
            </search>
            <add position="after" offset="4">
                <![CDATA[</div>]]>
            </add>
        </operation>

        <operation>
            <search>
                <![CDATA[            <p>{% for i in 1..5 %}]]>
            </search>
            <add position="before"> 
                <![CDATA[           
                {% if rating  > 0  and count_reviews > 0  %}
                 <div class="rating" itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
                    <span style="display:none;" itemprop="ratingValue">{{ rating }}</span>
                    <span style="display:none;" itemprop="bestRating">5</span>
                    <span style="display:none;" itemprop="worstRating">1</span>
                    <span style="display:none;" itemprop="reviewCount">{{ count_reviews }}</span>
                </div>
                {% endif %}]]>
            </add>
        </operation>

        <operation>
            <search>
                <![CDATA[    {{ column_right }}</div>]]>
            </search>
            <add position="before"> 
                <![CDATA[</div>]]>
            </add>
        </operation>
     </file>


     <file path="catalog/view/theme/*/template/product/review.twig">
        <operation>
            <search>
                <![CDATA[<table class="table table-striped table-bordered">]]>
            </search>
            <add position="replace" offset="6">
                <![CDATA[ 
                 <table class="table table-striped table-bordered" itemprop="review" itemscope itemtype="http://schema.org/Review">
                              <tr>
                                <td style="width: 50%;" itemprop="author"><strong>{{ review.author }}</strong></td>
                                <td class="text-right" itemprop="datePublished" content="{{ review.date_added }}">{{ review.date_added }}</td>
                              </tr>
                              <tr>
                                <td colspan="2"><p itemprop="reviewBody">{{ review.text }}</p>
                ]]>
            </add>
        </operation>
    </file>
</modification>

Regards
Himanshu


User avatar
Newbie

Posts

Joined
Mon Jul 10, 2017 10:55 am
Location - New Delhi

Post by letxobnav » Mon Sep 21, 2020 7:50 pm

You found some xml code on the internet and you would like us to test that for you.
ehhh, let me think about that.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by ahimanshu » Tue Sep 22, 2020 2:10 pm

letxobnav wrote:
Mon Sep 21, 2020 7:50 pm
You found some xml code on the internet and you would like us to test that for you.
ehhh, let me think about that.
Yes, if it is right for version 3.0.3.3, then many people can benefit. :)

Regards
Himanshu


User avatar
Newbie

Posts

Joined
Mon Jul 10, 2017 10:55 am
Location - New Delhi
Who is online

Users browsing this forum: No registered users and 7 guests