Jump to content
thirty bees forum

Automatic generate meta title/meta description


Recommended Posts

Posted

Hallo their. I see a lot of modules out their for PS 1.6 that create automatic meta information but non for TB. Can any of you recommend a great module for this ?

I like to be able to custom the way it creates the title Like this : Buy %productname from %brandname to %price

Any one know how to do this ?

  • 2 weeks later...
Posted

@30knees @Cassim

I use for my shops an older module from the PS forum. Here I can decide, for example, whether the meta-data description should be made from the short description of the product or from the normal long description, etc. Here I can also choose whether all products should get a new meta description or only those without content. Also a separate update of the categories is possible.

The module has only two problems incompatible with php 7 and the seoupdater.php has to be adapted since it has 255 characters as standard (but is the minor problem of that).

The entries with ,0,255)).'\' '; find and correct ;)

I personally wanted to expand this module for myself with a cronjob, I have not spent any time on it yet

0_1518130264455_12c6fffb-542d-4399-86b7-4589b6648104-grafik.png

01518130288691seoupdater 0.4.zip

Posted

Hi @30knees,

datakick module has it's own expression language. Expressions are something like excel formulas, and you can find them everywhere in my module (if you look hard enough). In lists (csv export), xml templates, mass updates, and even imports.

I will show you how expression works on List example. I will create a list that will show products and their reviews. To start, create a list based on Products collection, and then in dataset tab join Review collection:

0_1518153754505_DataKick - Data Manager > View • DataKick Demo 2018-02-09 06-19-35.png

Now we have list displaying all my products with their review. Something like this:

0_1518153944639_3f2d29a5-9305-4741-ad8b-0abe7cc10d16-image.png

In left column you will find any field from both products and reviews, and you can add it to list output. But you can also edit column, and change it's expression. For example, when I click on Review Title column in left panel, I get this

0_1518154088076_expr1.png

As you can see, expression says revwsReview.title. revwsReview is collection alias of Review collection, and title is field from this collection. This is the easiest expression possible, it simply returns review title. But we can change it, for example to:

products.name + ': ' + toLowerCase(revwsReview.title)

This will make the column display name of the product concatenated with review title, in lowercase:

0_1518154345857_98203446-390a-4ba8-9f83-d1136caf781f-image.png

And we can do some crazy stuff, there are plenty of function you can use. We have

  • conditionals: if(products.basePrice < 100, 'cheap', 'expensive') will show text cheap/expensive based on product price
  • arithmetics: (products.basePrice - products.wholesalePrice) calculates your profit margin.
  • string operations: replace(products.name, 'm', '-') will replace character m with dash in product name

0_1518155526550_0ffa9c2d-717b-4e33-8f67-53fde9f01ba9-image.png

Now, you can use these expressions anywhere. Here we used them to format list output. But you can use them to define conditions as well - you can filter your list and show only subset of data. Or you can use them to highlight some rows - in above example I highlighted cheap stuff.

And, you can use them else in the system. For example, in Mass Update. Now I'm getting back to your original question.

Mass Updates

To generate meta title, just create new mass update based on Products collection.

First step is to define what products to update. By default, all products would be updated. To change this, switch to Dataset tab, and create a condition. I will create a condition that match only products with 'IBIZA' in name:

0_1518155915735_e9e4a337-5027-454c-9dad-7808b7a80c3e-image.png

The condition builder let you easily create some common conditions in UI. But if you want, you can always click on the condition, and change it whatever you want.

Now, switch to the fields list, and find field you want to update. In our case, it's Meta title. Once you add it to list of Fields to update, click on in once again to edit:

0_1518156138587_ba754296-1a38-4ef4-9d41-e8f680289dd4-image.png

As you can see, the Update action is set to 'Set value', and New value is empty. If you have executed mass update now, it would set empty meta title. We don't want that. So, click on Action, and choose Custom expression. Now you can enter your update expression. For example

product.name +' just for ' + round(toNumber(product.basePrice),0) + ' EUR'

Mass update shows you how this will impact your data. In preview list, you see current value, and new value, so you can adjust your update expressions without actually modifying your data:

0_1518156440061_0fcdf35f-14b6-4c0c-85e1-823e9f5d4474-image.png

Once you are satisfied, you can click on Execute Update button, and your products will be updated. Simple as that.

You can, also, save this mass update and use it later. You can also schedule it to run every day or every hour, so your meta title will stay in sync with price.

Parameters

This is one thing that's very useful, but not very people knows about it. You can create a parameter and use it in expression. You will need to enter it's value when you run the mass update (or list,...).

This let you create reusable mass update. I'll show on example. Say you want to add 20% profit margin to your product price. You can create mass update that will use wholesale(purchase) price to calculate product price using this expression: product.wholesalePrice * 1.2

Or, we can make this mass update generic, and create numerical parameter margin. Once we create this parameter, we can use it in our expressions: product.wholesalePrice * ((100 + runtime.margin)/100)

Now, when you run this mass update, you will need to provide value for margin parameter, and this value will be used in expression during runtime (parameters are accessible using runtime alias)

Following example don't show wholesale price, but it's $50. New base price = 50 * (100 + 40 / 100) = $70

0_1518157086111_d7f5c457-18f9-44c6-a031-17c66f267a0f-image.png

Uff, that was long. I hope it answered your question :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...