Post by onoriotorti » Thu Aug 01, 2019 10:41 pm

Hi everyone,
I have a couple of questions that hopefully someone can help me with.
I am using version 3.0.3.1 with the journal 3 theme, right now it's all just being tested on my "test-site" www.cattex.com/test

I would like to add more stats next to the product price (see attached image green square)
right now thanks to journal theme iI can show all the information that's contained in the "DATA" tab inside the product within the admin.
That's great except I would like it to show also some of the attributes that the products have, basically the format of the product should be:

Views
Stock (qnt)
Model #
Weight
Packaging

I currently have it setup that way for my website and this is the code that does that:

Code: Select all

<file name="catalog/view/theme/*/template/product/product.tpl">
               <operation error="log">
	      <search position="before">
	        <![CDATA[<?php if ($reward) { ?>               
               ]]>
	      </search>
	      <add>
	        <![CDATA[
	      <!-- Start Additional Info -->
  <?php if ($attribute_groups) { ?>
    <?php foreach ($attribute_groups as $attribute_group) { ?>
      <?php if ($attribute_group['name'] == 'Product Details') { ?>
        <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
          <span><?php echo $attribute['name']; ?></span> <?php echo html_entity_decode($attribute['text']); ?><br />
        <?php } ?>
      <?php } ?>
    <?php } ?>
  <?php } ?>
  <!-- End Additional Info -->
<?php if ($attribute_groups) { ?>
    <?php foreach ($attribute_groups as $attribute_group) { ?>
      <?php if ($attribute_group['name'] == 'Dettaglio Prodotto') { ?>
        <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
          <span><?php echo $attribute['name']; ?></span> <?php echo html_entity_decode($attribute['text']); ?><br />
        <?php } ?>
      <?php } ?>
    <?php } ?>
  <?php } ?>
  <!-- End Additional Info -->
     ]]>
	    </add>
	      </operation>
	</file>
this would show all the attributes inside the "Product Detail" group in the required section, unfortunately with 3.x having TWIG files I have no clue how to implement.

The second request should be easier, I basically what it to show just the phrase "w/o Tax" on the product page (remove red square in attached image)

Both of the request should work for the "product page" and "quickview page"

Thanks in advance to anyone who can provide any help.

Attachments

product-page.jpg

product-page.jpg (75.06 KiB) Viewed 4613 times


New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by xxvirusxx » Fri Aug 02, 2019 12:53 am

Code: Select all

<file name="catalog/view/theme/*/template/product/product.twig">
               <operation error="log">
	      <search position="before">
	        <![CDATA[{% if reward %}
               ]]>
	      </search>
	      <add>
	        <![CDATA[
	      <!-- Start Additional Info -->
  {% if attribute_groups %}
    {% for attribute_group in attribute_groups %}
      {% if attribute_group.name == 'Product Details' %}
        {% for attribute in attribute_group.attribute %}
          <span>{{ attribute.name }}</span> {{ attribute.text }}<br />
        {% endfor %}
      {% endif %}
    {% endfor %}
  {% endif %}
  <!-- End Additional Info -->
 {% if attribute_groups %}
   {% for attribute_group in attribute_groups %}
      {% if attribute_group.name == 'Dettaglio Prodotto' %}
        {% for attribute in attribute_group.attribute %}
          <span>{{ attribute.name }}</span> {{ attribute.text }}<br />
       {% endfor %}
      {% endif %}
    {% endfor %}
  {% endif %}
  <!-- End Additional Info -->
     ]]>
	    </add>
	      </operation>
	</file>

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by onoriotorti » Fri Aug 02, 2019 3:23 pm

xxvirusxx wrote:
Fri Aug 02, 2019 12:53 am

Code: Select all

<file name="catalog/view/theme/*/template/product/product.twig">
               <operation error="log">
	      <search position="before">
	        <![CDATA[{% if reward %}
               ]]>
	      </search>
	      <add>
	        <![CDATA[
	      <!-- Start Additional Info -->
  {% if attribute_groups %}
    {% for attribute_group in attribute_groups %}
      {% if attribute_group.name == 'Product Details' %}
        {% for attribute in attribute_group.attribute %}
          <span>{{ attribute.name }}</span> {{ attribute.text }}<br />
        {% endfor %}
      {% endif %}
    {% endfor %}
  {% endif %}
  <!-- End Additional Info -->
 {% if attribute_groups %}
   {% for attribute_group in attribute_groups %}
      {% if attribute_group.name == 'Dettaglio Prodotto' %}
        {% for attribute in attribute_group.attribute %}
          <span>{{ attribute.name }}</span> {{ attribute.text }}<br />
       {% endfor %}
      {% endif %}
    {% endfor %}
  {% endif %}
  <!-- End Additional Info -->
     ]]>
	    </add>
	      </operation>
	</file>
Unfortunately it didn't work, also tried adding the code directly within "product.twig" because I don't belive there's a {% if reward %} line inside that file, so vqmod wasn't doing anything.
I also tried it with default theme and still no luck.

New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by by mona » Fri Aug 02, 2019 7:09 pm

because I don't belive there's a {% if reward %} line inside that file
suggestion - check whether {% if reward %} is in the catalog/view/theme/xx/template/product/product.twig file?
- change the {% if reward %} in the xml file to something that is in the product.twig file?

and remember to clean out your cache both in vqmod and dashboard.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by onoriotorti » Fri Aug 02, 2019 8:10 pm

by mona wrote:
Fri Aug 02, 2019 7:09 pm
because I don't belive there's a {% if reward %} line inside that file
suggestion - check whether {% if reward %} is in the catalog/view/theme/xx/template/product/product.twig file?
- change the {% if reward %} in the xml file to something that is in the product.twig file?

and remember to clean out your cache both in vqmod and dashboard.
I have inserted the suggested code within the product.twig right before this section:

Code: Select all

{% if j3.settings.get(stylePrefix ~ 'ProductReward') and reward %}
<li class="product-reward"><b>{{ j3.settings.get(stylePrefix ~ 'ProductRewardText') }}:</b> <span>{{ reward }}</span></li>
{% endif %}
avoided using vqmod just to test out and cleared all caches I could think of.
Unfortunately no result.

New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by xxvirusxx » Sat Aug 03, 2019 1:46 pm

onoriotorti wrote:
Fri Aug 02, 2019 3:23 pm
I don't belive there's a {% if reward %} line inside that file
It is on Default theme......

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by onoriotorti » Mon Aug 05, 2019 3:00 pm

xxvirusxx wrote:
Sat Aug 03, 2019 1:46 pm
onoriotorti wrote:
Fri Aug 02, 2019 3:23 pm
I don't belive there's a {% if reward %} line inside that file
It is on Default theme......
yeah, if you look at my initial answer it clearly says that I also tried it on Default and still no result.

New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by onoriotorti » Wed Aug 07, 2019 2:24 pm

is this not possible to achive?

New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by by mona » Wed Aug 07, 2019 3:50 pm

Hi onoriotorti,
is this not possible to achive?
Yes


yeah, if you look at my initial answer it clearly says that I also tried it on Default and still no result.
Yes it does



Please understand that people provide their time here to help you out of the goodness of their hearts.
If this does not work for you then the reason will be as previously advised ..
You can contact your paid theme developer or extension developer to assist you with finding the piece of code that they have removed which is preventing this from working.

I do not mean to be harsh, I am just trying to explain why this has not received a response.

Attachments

Screen-Shot-2019-08-07.jpg

Screen-Shot-2019-08-07.jpg (27.9 KiB) Viewed 4393 times


DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by onoriotorti » Thu Aug 08, 2019 2:40 pm

by mona wrote:
Wed Aug 07, 2019 3:50 pm
Hi onoriotorti,
is this not possible to achive?
Yes


yeah, if you look at my initial answer it clearly says that I also tried it on Default and still no result.
Yes it does



Please understand that people provide their time here to help you out of the goodness of their hearts.
If this does not work for you then the reason will be as previously advised ..
You can contact your paid theme developer or extension developer to assist you with finding the piece of code that they have removed which is preventing this from working.

I do not mean to be harsh, I am just trying to explain why this has not received a response.
Yes belive me I understand, this forum has really helped me in the past and I'm sorry if I sounded needy :)
I just wanted to make sure that it wasn't a code issue, before the image you attached I had no assurance it actually worked. (not an expert as you can see)
Now I know it's defenetly an issue on my side so I will go from there.

New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by xxvirusxx » Mon Aug 12, 2019 2:00 pm

Tested on Journal 3 and code work just fine....

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by onoriotorti » Wed Aug 28, 2019 7:54 pm

xxvirusxx wrote:
Mon Aug 12, 2019 2:00 pm
Tested on Journal 3 and code work just fine....
can you please explain how?
here is my xml code and it does not work for me:

Code: Select all

 <modification>
              <file name="catalog/view/theme/journal3/template/product/product.twig">
               <operation error="log">
	      <search position="before">
	        <![CDATA[{% if j3.settings.get(stylePrefix ~ 'ProductReward') and reward %}
               ]]>
	      </search>
	      <add>
	        <![CDATA[
  {% if attribute_groups %}
    {% for attribute_group in attribute_groups %}
      {% if attribute_group.name == 'Product Details' %}
        {% for attribute in attribute_group.attribute %}
          <span>{{ attribute.name }}</span> {{ attribute.text }}<br />
        {% endfor %}
      {% endif %}
    {% endfor %}
  {% endif %}
 {% if attribute_groups %}
   {% for attribute_group in attribute_groups %}
      {% if attribute_group.name == 'Dettaglio Prodotto' %}
        {% for attribute in attribute_group.attribute %}
          <span>{{ attribute.name }}</span> {{ attribute.text }}<br />
       {% endfor %}
      {% endif %}
    {% endfor %}
  {% endif %}
     ]]>
	    </add>
	      </operation>
	</file>
</modification>

New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by xxvirusxx » Wed Aug 28, 2019 7:59 pm

You attributes name is Product Details or Dettaglio Prodotto ?

And refresh ocmod, clear vqmod cache if you use, clear theme cache, SASS cache

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by onoriotorti » Wed Aug 28, 2019 10:08 pm

xxvirusxx wrote:
Wed Aug 28, 2019 7:59 pm
You attributes name is Product Details or Dettaglio Prodotto ?

And refresh ocmod, clear vqmod cache if you use, clear theme cache, SASS cache
both, it's the same data but depending on the language it will show in Italian or in English.
Refreshing all the caches worked i think all the other times I never refreshed ocmod and that's why it wasn't showing.
I have attached the final result, the only thing is that I would like to show everything on one line so:

instead of:

Confezione:
1 pezzo

can it be:

Confezione: 1 pezzo

thank you for the help i really preffer to show certain data right away and this is perfect.

Attachments

image1.JPG

image1.JPG (14.4 KiB) Viewed 4181 times


New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by onoriotorti » Wed Aug 28, 2019 10:15 pm

also it does not show in quickview page, I'm assuming that is controlled in a different file.

New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by letxobnav » Wed Aug 28, 2019 11:12 pm

not so handy using names in your logic, especially when your site is multi-lingual.

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 onoriotorti » Thu Aug 29, 2019 4:52 pm

letxobnav wrote:
Wed Aug 28, 2019 11:12 pm
not so handy using names in your logic, especially when your site is multi-lingual.
So how should it be?

New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by letxobnav » Thu Aug 29, 2019 5:09 pm

you use the attribute_group_id( make sure it is passed to the view), names change and are different in multi-lingual setups, the id remains the same .
Then you also do not have to duplicate logic for every language.

Code: Select all

  {% if attribute_groups %}
    {% for attribute_group in attribute_groups %}
      {% if attribute_group.attribute_group_id == WHATEVER THE ID IS FOR PRODUCT DETAILS %}
        {% for attribute in attribute_group.attribute %}
          <span>{{ attribute.name }}</span> {{ attribute.text }}<br />
        {% endfor %}
      {% endif %}
    {% endfor %}
  {% endif %}

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 onoriotorti » Thu Aug 29, 2019 5:26 pm

letxobnav wrote:
Thu Aug 29, 2019 5:09 pm
you use the attribute_group_id( make sure it is passed to the view), names change and are different in multi-lingual setups, the id remains the same .
Then you also do not have to duplicate logic for every language.

Code: Select all

  {% if attribute_groups %}
    {% for attribute_group in attribute_groups %}
      {% if attribute_group.attribute_group_id == WHATEVER THE ID IS FOR PRODUCT DETAILS %}
        {% for attribute in attribute_group.attribute %}
          <span>{{ attribute.name }}</span> {{ attribute.text }}<br />
        {% endfor %}
      {% endif %}
    {% endfor %}
  {% endif %}
ok I will try, also to have everything on the same line it's necessary to just move the </span> tag

Code: Select all

<span>{{ attribute.name }} {{ attribute.text }}</span><br />
would you happen to know if this could possibly work even for the quickview page of a product?

New member

Posts

Joined
Tue Jun 20, 2017 5:36 pm

Post by letxobnav » Thu Aug 29, 2019 5:44 pm

well, I do not see why you need a <span> tag anyway if it adds no functionality.

I do not know how quickview works, whether it has it's own view logic in the twig file or not.
All I can tell you is that if you properly pass the attribute_groups from the controller to the twig file, you can use that array anywhere.

$data['attribute_groups'] = $this->model_catalog_product->getProductAttributes($this->request->get['product_id']);

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
Who is online

Users browsing this forum: No registered users and 30 guests