Hybris Impex create a script for Product import - sap-commerce-cloud

I've tried searching for examples, but all of them produce problems for me. Here's the easiest one, which looks like it's supposed to work
$lang=en
$productCatalog=productCatalog
$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
INSERT_UPDATE Product;code[unique=true];catalogVersion ;M300047;$productCatalog:Staged
I'm new to Hybris, especially Hybris Impex and am kinda stuck at this point, so I'd appreciate your help for sure.

Seems the syntax is wrong on the header of the INSERT_UPDATE. You are missing a $ in the catalogVersion attribute. Also, usually, catalogVersion is also used as a unique attribute, so you don't duplicate codes inside the same catalog. It should be like this:
INSERT_UPDATE Product;code[unique=true];$catalogVersion[unique=true]
You can also find more examples and explanations here if you don't have access to help.hybris.com yet.

Related

Grav - Parse URL

I want to define a new template called "product".
This template calls an external service and retrieves the information about that specific product. That is easily done with a custom plugin that access the product information. Information on how to do that has been found here.
However, I would like that the URL of the page would be something like:
/product/<id>/<seo-friendly-description>
So I can retrieve in the Twig template both <id> and <seo-friendly-description> which will be used later to retrieve the specific product information.
I have tried to find something that could help in the documentation, without success. Could someone either point me to the right doc section or highlight the basic steps that shall be achieved so I can start solving this issue?
Just in case it helps, I am trying to find something similar to how bottle or other web frameworks work:
#route('/hello/<name>')
def greet(name):
return 'Hello ' + name
I've been building a family recipebook into my own website and I've been working through a similar problem. I haven't quite worked out all the kinks, but my solution is mostly working if you want to checkout my github repo.
In short, you need the plugin to watch what the active route is. If the route matches, you then create the page and populate it using your plugin data.
I haven't quite figured out how to get the active page to highlight in the navigation menu for generated pages, but you might still find this solution helpful.

Azure Search suggestions setup

I've created an instance of Azure Search and I'm trying to make use of the suggesters functionality but struggling to find any useful information on how to get started (poor and out of date documentation from Microsoft).
I would like to use a suggestion on the name field below.
The issue is that fields require unique names and I'm unable to edit existing fields. I'm a little unsure of how the suggester tab differs from basic.
Does anyone have any advice on how best to add suggesters to my index? I am all for deleting the index and starting again if I've missed something critical.
I'm really sorry you're disappointed by the documentation. We take it very seriously and will make sure to address your feedback. Feel free to make suggestions.
On the screen you provided, you should specify a name for the suggester. Once you do that, checkboxes will show up next to your field names. Using the check boxes you will enable the Suggestions API on selected fields.
Use the name of the suggester as a value for the suggesterName parameter when using the Suggestions API : https://msdn.microsoft.com/en-us/library/azure/dn798936.aspx
Please find more details in this article about suggestions in Azure Search. It describes a sample application with code attached.
Hope that helps.

Modify Orchard Archive Filter

I am new to Orchard CMS may be this can be easily achievable I don't know how to do it exactly as i have searched a lot on Google. I have a blog where I need to display the archive in drop down Eg :
I checked the blog module and I don't know how can I filter it so that I can get this. Do I have to create a new module to achieve this or a tweak in the Blog module will work. I Read the sky-walker tutorial to understand how to create a module but i don't know how to achieve this.
You need to override the Parts.Blogs.BlogArchives.cshtml, very easy. That is what Orchard is all about. you can read more about it in the documentation.
Check this Accessing Shapes , for starters.

Modx - Extend site_content - Add new table

Currently, we're running revolution 2.2. On site_content, we have some tags that are ran for crawling twitter. I want to start tracking the number of results for each tag as results come in, to determine which tags don't return that many results, etc.
So I was thinking that I should create a new table (twitter_data), and have a foreign key that will link it to the search tag ID, which is stored in site_content.
What is the best path to accomplish this? Should I create my table then run the reverse schema tool, outlined here?
http://rtfm.modx.com/display/revolution20/Reverse+Engineer+xPDO+Classes+from+Existing+Database+Table#ReverseEngineerxPDOClassesfromExistingDatabaseTable-CreatingaMySQLtable
I also found this, but not sure if this is what I should be looking into:
http://rtfm.modx.com/display/revolution20/Using+Custom+Database+Tables+in+your+3rd+Party+Components
Probably not - if you can avoid modifying the core modx schema do so. an external table may be your best option, but requires a fair bit of work.
though if you can explain wht you mean by 'tags' a little better [html tags? snippets? content tags? not sure what you mean] there may be other options. for example. one of our clients wanted to count page hits [and didn't want to use google to do it] so all we did was to create a template variable bound to each page they wanted to count and then updated that appropriate variable by writing plugin to fire on the onpageload or onpagerender event. [I don't ermember exactly which or what it was called]
Basically, you may be able to do this by writng a plugin rather than trying to extend anything or add snippets/chunks.

Custom attributes on fields in SubSonic

SubSonic newbe question;
I want to put custom attributes on properties in the generated classes, is that possible?
It's definitely possible. Is this SubSonic 2 or 3? It's doable for either one, but the question of where to find the templates is different depending on which one you're using.
Edit: For SubSonic 2, follow this link and look at the entry on "templateDirectory". For SubSonic 3, you probably have some .tt files in your VS Project you can mess with.
There's two ways to do this:
If you want to add them at generation time you can do what Skinniest Man suggests and modify the templates to add them.
If you want to add them manually things are a little more tricky and you'll need to create a 'buddy class' and apply your custom attributes to that. You can see an example for data annotations here which should illustrate the concept.

Resources