Subcategories of subcategories in SuiteCommerce Advanced - oracle

Good day everyone,
I don't think that I've seen a website that has pulled this off yet. I want to try and display the subcategories of a parent category's subcategories; if that makes sense.
Parent Category (parent category)
Subcategory (parent subcategory)
subcategory (child subcategory)
Parent subcategory items
We're currently using NetSuite's SuiteCommerce Advanced to manage the webstore. My developer has said that we're unable to script this. We can pull the subcategories and it's items, but we cannot go further than that.
The best approach appears to have the child subcategory content coded in HTML and then display the HTML onto the facets_category_cell.tpl file
I first created an other record field, assigned it to the Commerce Categories and named it subcategory HTML. The field type is rich text, this seems to be right field type for HTML.
After I saved the Commerce Category with the subcategory HTML content. I went to the facets_category_cell.tpl file, and added the field into the code. I tried two ways, and I was unable to get the HTML to display. It was always blank.
{{custrecordsubcathtml}}
{{modal.custrecordsubcathtml}}
Below is the code we have currently, to pull the subcategories. I added the custrecordsubcathtml tag below the description.
<div class="facets-category-cell" id="facets-category-cell-{{intlid}}" data-id="{{intlid}}">
<div class="facets-cell-anchor" id="facets-cell-anchor-{{intlid}}"><a name="cat-{{intlid}}">{{name}}</a></div>
<div class="facets-category-cell-title">
<div class="facets-category-cell-left {{#if hasImage}} image {{/if}}" id="category-name-{{intlid}}">
{{name}}
<div class="facets-category-cell-description">{{theDesc}}</div>
<div>{{custrecordsubcathtml}}</div>
</div>
{{#if hasImage}}
<div class="facets-category-cell-thumbnail" onclick="toggleCatCell(this)" data-id="{{intlid}}">
<img loading="lazy" src="{{resizeImage image 'thumbnail'}}" alt="{{name}}" class="facets-category-cell-image">
</div>
{{/if}}
<div class="facets-category-cell-arrow" id="facets-category-cell-arrow-{{intlid}}" onclick="toggleCatCell(this)" data-id="{{intlid}}">
<span class='fa chev-right'></span>
</div>
</div>
<div id="seriesDiv{{intlid}}" class="hideHandheld"></div>
</div>
Is there a certain way that I have to pull this information? or are we unable to accomplish this?

Related

Click on a element with specific text

Alright, I have a item which has this class class="country" and there are 12 elements with the same class. Now I want to get a element on its value. For example Italy. And now I want to click on a link in this item. The class of the link is class="link". So basically I want to click the link of the item with the name Italy
My code at the moment:
cy.get('.country').should('have.text', 'Italy').click();
HTML
<div class="countries">
<div class="text">
<h3></h3>
<div class="country">Italy</div>
<h4>Yala</h4>
<p>test</p>
<a class="link" href="/mysite">Show details</a>
</div>
</div>
Should() is an assertion and won't select the element you want.
you probably want the contains() function.
cy.get('.country').contains('Italy').click()
Best

Pagination is not showing

I'm trying to get pagination into my view. I don't know where is the problem, the code doesn't show any errors.
Here is my controller function
public function apakskategorijas($id)
{
$apakskat = apakskategorijas::with('prece')->where('id',$id)->paginate(2);
return view ('kategorijas.apakskategorijas',compact('apakskat'));
}
View
#section('content')
#foreach($apakskat as $apk)
#foreach($apk->prece as $prec)
<div class="col-md-4 kat">
<a href="{{ url('kategorija/apakskategorija/preces/'.$prec->id) }}">
<div>
<img src="{{ URL::to($prec->path) }}">
</div>
<div class="nos">
<p>{{$prec->nosaukums}}</p>
</div></a>
<div class="price-box-new discount">
<div class="label">Cena</div>
<div class="price">{{ $prec->cena }} €</div>
</div>
<div><span>Ielikt grozā</span></div>
</div>
#endforeach
#endforeach
<center>{{$apakskat->links()}}</center> <--pagination
#endsection
dd($apakskat)
UPDATE
when i changed code in my controller to $apakskat = apakskategorijas::paginate(1); then it showed me pagination, but this doesn't work for me since i need to display items in each subcategory, with this code it just displays every item i have,it doesn't filter which subcategory is selected.
This is why i need this $apakskat = apakskategorijas::with('prece')->where('id',$id)->paginate(1); with is a function that i call which creates a relation between tables, so that it would display every item with its related subcategory.
That's the behavior of paginator in current Laravel version. When you have just one page, pagination links are not displayed.
To test this, just change the code to something like this to get more pages:
$apakskat = apakskategorijas::paginate(1);
If you want to show the first page if there is only one page, you need to customize pagination views. Just publish pagination views and remove this #if/#endif pair from the default.blade.php but keep the rest of the code as is:
#if ($paginator->hasPages())
....
#endif

is it possible to load ajax on web page load

im using panel collapse in bootstrap and has a parent category and child category
The parent was display for panel-title and the child categories was display on the panel-collapse to perform an ajax to load posts under child category
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse1">Parent categories</a>
</h4>
<div id="collapse1" class="panel-collapse collapse">
<a onclick(perform ajax event)><li>child categories</li>
</div>
my problem was on page load all post was executed already. i just want only to show the post of the array 0 or to load an ajax on page load

How to mark only product categories?

How do I have to mark my website product categories? … only categories …
Maybe with category from Offer?
Something like:
<div itemscope itemtype="http://schema.org/Offer">
<a itemprop="category" href="category1.php">My category 1</a>
</div>
You should not specify category on an a element. The value would be the URI (category1.php), not the content (My category 1).
category expects a value that is either text or another item.
So if you want to provide text, you could use something like:
<div itemscope itemtype="http://schema.org/Offer">
<span itemprop="category">My category 1</span>
</div>
And yes, it is totally fine to use only one property. Schema.org doesn’t define required properties. But consumers (e.g., search engines) might, of course, only consider re-using your data if it fulfils certain of their own requirements.
UPDATE: If you want to provide several categories for the item, it could be something like:
<div itemscope itemtype="http://schema.org/Offer">
<ul>
<li itemprop="category">My category 1</li>
<li itemprop="category">My category 2</li>
<li itemprop="category">My category 3</li>
</ul>
</div>
Don’t rename the category property! Adding 1, 2 etc. to it would be wrong.
(And it it’s a hierarchy of categories, you could use one value and / or >., e.g. Sports > Tennis.)

Xpath not just getting parent of html

I am trying to find the xpath for only the parent of a navigation bar. The path which I am trying at the moment is `//a[#class='unselectable'] from this peace of HTML.
`<div class="PrimaryNavigationContainer">
<div class="PrimaryNavigation">
<div class="Menu">
<div>
<a href="http://www.blah.co.uk/brands.aspx" class="unselectable"><span>
Brands</span></a>
<div class="navCol">
<div>
<a class="NoLink unselectable"><span>Shop by Brand</span></a>
<div class="navCol subMenus">
div>
<a href="http://www.blah.co.uk/blah/catlist_bd4.htm" class="unselectable"><span>
blah</span></a>
The xpath seem to be bringing up both the top level cats and sub categories and I am because it is in both but not sure how to single of the parent from the chld. Thanks for any help which you can provide
How about //div[#class="Menu"]/div/a[#class='unselectable']? This way you avoid selecting the a in the subMenus div.

Resources