How can I add product to cart programmatically in opencart verion 1.4.9.4 - opencart2.x

I am customizing my clents store in opencart 1.4.9.4. I want to add a product dynamically to cart. I tried using
$this->cart->add($giftvoucher], $quantity, $option);
But it is not working

you have to check if there options or not
the easy way to do that using ajax
if you mean that you want json code this is it:
$this->cart->add($this->request->post['product_id'], $quantity, $option, $recurring_id);
if you don't have $recurring_id just delete it

Related

Is there a simple example on how to add an entity extension for customers with field in the admin of shopware 6?

I want to add an entity extension to a customer in shopware 6. I was able to do so with the examples in the documentation of shopware on the PHP side and now I wonder how to display and modify this new "field" in the shopware 6 backend.
I searched a lot and also tried to find a simple plugin where I could get some inspiration from, but unfortunately I'm not able to find.
So again the question 😊 Is there any simple example on how to add an entity extension for customers with field in the admin of shopware 6? Or an example plugin, where I can see how it could be done?
What you're (likely) trying to achieve would be the combination of multiple separate tasks.
If you want to store data in the database you'd need a new custom entity
If you want to associate the new entity with the customer you'll need the entity extension
You'll need to add a new field in the administration
I've linked to examples respectively, but you'll probably need to take the time and invest in studying the documentation regardless.
I also created an example plugin that combines all these steps and adds a new entity with a height field as association to the customer and displays the field in the administration. You can find the repository here.
Not sure if you considered this, but depending on what you are trying to accomplish, the simplest way is probably adding a custom field (this can be done progamatically or even via the admin panel).
The drawback is, that those fields' values are stored as JSON and it has drawbacks when you try to search through them.

Customise Netsuite Site Builder Cart

So I've been tasked with getting a custom item field value displayed on an item in the cart of a site-builder site.
I have experience with SCA but not so much when it comes to site builder. I can see how templates are put together and how to display data in these templates.
I can also tell that it is possible to add or remove field sets from the cart in the 'Set Up Website' tab.
Another thing to note is that the Live Hosting Files are empty.. which is where I would have expected to find the scripts that would create the cart.
So my question is, how do I either create a new row in the 'Set Up Website => Cart' tab to display this new custom field. Or where can I find and edit the template/script that creates the cart?
Any help is appreciated!
Is this the old SiteBuilder Cart or from the new SiteBuilder Extensions? If so, which version? The old, original SiteBuilder Cart is really difficult to add customizations such as a custom field. I would do it by running an AJAX call on a SuiteScript to get the needed data that write it into the cart cell. It was a hack but at least I was able to customize it.
The SB Extensions work a lot like SCA, and it what to do depends upon the version. If it is only for the cart, then just extend Item Keys Mapping and then it will be available on the template file. If you also need it on the cart summary in the checkout then, see SuiteAnswers for the specifics for the various versions.

Modx - Add custom field to mod_site_content

Is it possible to add a custom field to modx_site_content? What I'm trying to accomplish, is to add a field t_id. I've already added this in the database. However, when I save it using: $object->save(); nothing is saved for that field, it just comes up as Null.
The version I'm using is: MODX Revolution 2.2.4-pl (June 14, 2012)
Actually - I've answered that question before. You want to create a separate table and schema.
modx evolution external database
however - it looks like you want to add a field so that you can call it as part of the page/template in modx? You may have to write a plugin to extract that data at the same time as the resource.
I know this is an old topic, but now the ClassExtender extra will create the additional table for you based on your schema, add the additional fields to the Create/Edit Resource panel with a plugin, and save those field values to the table in the DB when the Resource is saved in the Manager. This can save a lot of time and trouble.
If you can wait, a new version that works in MODX 3 should be released soon.

Add finding attribute by name in Opencart Admin panel: Catalog - Attributes - Attributes

How to implement Attribute to find his own name in the admin area in Opencart : Products - Attributes - Attributes? Is that there is a separate field and simply by driving into the field and displays the name of the attribute is an attribute, as usual searching for items in the admin by name, but only with attribute
It's hard to understand what you are asking, but if you are trying to use attributes for products then you must first define them at catalog>attributes>attributes.
To List attributes in the Products tab you will need edit these files
admin>view>template>catalog>product_form.tpl
admin>controller>catalog>product.php
If your understanding of PHP or Opencart isn't very strong it will help you to copy data from the attribute.php controller to the product.php controller.
As for the search function, this is something I haven't done before but you could try using the search function on the front of the website as reference.
I recommend working through this as best you can then asking more questions if or when you get stuck.
*Update
Ok so since HTML is your strenth it will be smartest to start from there. Open any of these files (the ones that have the data you need).
admin>view>template>catalog>attribute_form.tpl
admin>view>template>catalog>attribute_group_form.tpl
admin>view>template>catalog>attribute_group_list.tpl
admin>view>template>catalog>attribute_list.tpl
Then work backwards with what you see. The tpl will show variables that look like $attribute, track these back to
admin>controller>catalog>attribute.php
admin>controller>catalog>attribute_group.php
And you will see how all the code is used to pull the data from the model and format it if necessary.

custom appcelerator table search field

I'm developing an iOS 4.3 app for a client using Appcelerator Titanium SDK 1.6.2.
I need to filter a tables results but, per the design spec, cant have the search bar attached to the table. When I use the SearchBar element and attach it to the tables search attribute its automatically added to the head of the table.
Is there a way to define a custom search field or force the SearchBar element to detach from the table?
Thanks for your help,
Josey
you do not have to add the search bar to the table...
can you post some sample code so I can get better understanding of you implementation?

Resources