The Bigcommerce API documentation for Product Rules says the following in the Update a Product Rule section:
Updates an existing product rule. NOTE: if you include a conditions object array, its contents will be appended to any existing conditions. This operation does not overwrite existing conditions.
I need to delete existing conditions from a rule, but I can't figure out a way to do it. No matter what you pass in for conditions, it just gets appended to the conditions that are already there. You also can't clear out the conditions first, because the request is rejected if the conditions array is empty.
Is there any way to remove conditions from a rule besides recreating the entire rule?
First, BigCommerce is a little wonky.
I think your best bet is to simply go the manual route, with a 4 step process:
Ge the original rule and store it in a variable, via:
GET /stores/{store_hash}/v2/products/{product_id}/rules/{id}
Then Delete the original rule via:
DELETE /stores/{store_hash}/v2/products/{product_id}/rules/{id}
Now, edit the JSON response you store with the GET method to reflect the changes you want to make,
Finally, re-create the rule with your changes via:
POST /stores/{store_hash}/v2/products/{product_id}/rules/{id}
passing your edited JSON response as parameters.
Let me know if this helps and if you have nay other questions.
Related
How to handle the remove flight booking in webtours? It came to my mind that if I wanna run the test with 3 virtual users and how they supposed to delete the booking if the information down here (refer below) are unique for each virtual user? Does any of these variables below need to be parameterized or need to apply correlation?
If there are multiple flight id to be deleted, we can create a CSV file having those ids
and use a while loop controller to delete each of them.
You may refer -
https://guide.blazemeter.com/hc/en-us/articles/206733689-Using-CSV-DATA-SET-CONFIG
https://www.blazemeter.com/blog/using-while-controller-jmeter
As you said, it will differ for a different user, you can store each value from the response of each user(extract value using regex) and pass them in delete call.
reference link - https://guide.blazemeter.com/hc/en-us/articles/207421325-Using-RegEx-Regular-Expression-Extractor-with-JMeter-Using-RegEx-(Regular-Expression-Extractor)-with-JMeter
I don't know what "webtours" is, however there is one "golden" rule: each and every parameter which is dynamic needs to be correlated.
If you don't have any idea regarding which ones are dynamic - record the same action one more time using JMeter's HTTP(S) Test Script Recorder and compare the generated requests, parameter values (or even names) which differ needs to be correlated.
Another approach is to inspect the previous response(s) using View Results Tree listener and look if the data is present there
Check out Advanced Load Testing Scenarios with JMeter: Part 1 - Correlations article for more information and example implementation
I'd like to delete a single DNS record (an A record) through the API via CURL or any other Shell/Bash command.
I also tried to access GoDaddy's website but unfortunately it no longer exists and returns 404.
https://www.godaddy.com/community/Managing-Domains/Deleting-a-single-DNS-record-through-the-API/td-p/108003
Is it possible, how can I do that?
EDIT The original answer seems to be obsolete
GoDaddy has added the respective endpoint to delete a single entry. So now you can do
DELETE /v1/domains/{domain}/records/A/{name}
Original answer
Unfortunately, godaddy's api does not provide the endpoint for deleting a single domain record in a single call. So you will have to
GET /v1/domains/{domain}/records/A to fetch all A-records for the domain first (https://developer.godaddy.com/doc/endpoint/domains#/v1/recordGet)
remove the record to delete from the resulting list
PUT /v1/domains/{domain}/records/A the modified recordset to replace all A-records for the domain with the given list of records (https://developer.godaddy.com/doc/endpoint/domains#/)
As the API endpoints return/expect JSON data, you might need some additional tool to manipulate the json data. You might find something in this answer Parsing JSON with Unix tools
You might be tempted to use PUT /v1/domains/{domain}/records/A/{recordname} to replace all A-records with the given name with the provided list of records (https://developer.godaddy.com/doc/endpoint/domains#/v1/recordReplaceTypeName) using an empty list of records in the body. The last time I tried that, it didn't work.
I have such a case:
I created appropriate combinations of attributes, assigned prices to them. However, I need to add another attribute that will simply add a discount to calculated price. How to do this? I don't want to add other combinations because I would have to modify many newcombinations and prices manually. I would like to make it simply possible to choose one additional attribute which will give a percentage discount to the calculated price. Is it possible?
If I understand correctly, I think that you can use a catalog rule. Catalog rules are defined under:
Discount rules -> Catalog rules
Maybe they are named exactly differently because I donĀ“t use Prestashop in English and I am translating from another language. Once there you need to create a new rule using the plus ("+") sign at the top right. Once at the rule creation, use "Add a new group condition" at the bottom. There you may choose product characteristics to fire the rule. Remember to click on the "+" at the right to add the condition before saving.
In my sitecore instance, I have content for 2 templates, Product and Product Category. The products have a multilist that link to the Product Category as lookups. The Products also have an indexing computed field setup that precomputes some data based on selected Product Categories. So when a user changes a Product, Sitecore's indexing strategy indexes the Product with the computed field.
My issue is, when a user changes the data in the Product Category, I want Sitecore to reindex all of the related products. I'm not sure how to do this. I do not see any hook where I could detect that a Product Category is being indexed, so I could programmatically trigger an index to products
You could achieve using the indexing.getDependencies pipeline. Add a processor to it - your custom class should derive from Sitecore.ContentSearch.Pipelines.GetDependencies.BaseProcessor and override Process(GetDependenciesArgs context).
In this function you can get your IndexedItem and add, based on this information, other items to the Dependencies. These dependencies will be indexed as well. Benefit of this way of working is that the dependent items will be indexed in the same job, instead of calling new jobs to update them.
Just be aware of the performance hit this could cause if badly written as this code will be called on all indexes. Get out of the function as soon as you can if not applicable.
Some known issues about this pipeline can be found on the kb.
One way would be to add a custom OnItemSave handler which will check if the template of the changed item has the ProductCategory template, and will problematically trigger the index update.
To only reindex the changed items, you can pickup the related Products and register them in the HistoryEngine by using the HistoryEngine.RegisterItem method:
Sitecore.Context.Database.Engines.HistoryEngine.RegisterItemSaved(myItem, new ItemChanges(myItem));
Some useful instructions how to create OnItemSave handler can be found here: https://naveedahmad.co.uk/2011/11/02/sitecore-extending-onitemsave-handler/
You could add or change one of existing index update strategies. (configuration\sitecore\contentSearch\indexConfigurations\indexUpdateStrategies configuration node)
As example you could take
Sitecore.ContentSearch.Maintenance.Strategies.SynchronousStrategy
One thing, you need to change
public void Run(EventArgs args, bool rebuildDescendants)
method. args contains changed item reference. All that you need, trigger update of index for related items.
After having custom update strategy you should add it to your index, strategies configuration node.
Goal:
Show all products to all users who have access rights to the purchase module.
However besides the above rule show only products who have value 'secfab' in the reference field to the users who created the same product.
Problem:
I tried using access records but my logic to build it is weak and I need help.
Case 1:
[('default_code','!=','secfab'),('created_id','=',user.id)]
If I code this then I only get one record and other records are not shown.
Case 2:
['|',('default_code','!=','secfab'),('created_id','=',user.id)]
If I code this then I only all the records and I am not able to achieve privacy that I wanted.
Any Help will be highly appreciated.
Your second case seems to be correct, except the clause for filtering on the creator looks misspelled. This typo could cause the rule to match all records, because the condition on the non-existing field created_id cannot be verified. Shouldn't it be:
['|', ('default_code', '!=', 'secfab'), ('create_uid', '=', user.id)]
which translates to "show all products that don't have secfab as code, plus all products, that the user created, regardless of their code", and seems to do what you want?
create_uid is one of the 4 fields automatically added by the system to all models that have _log_access set to True, which is the default. This is explained in the OpenERP technical memento and in the special fields documentation.