All Questions

Tagged with
1
vote
0answers
25 views

How can I change multiple entries in DB?

In DB I have Rows: ID NAME PHONE Example: 1 Steave 33333333 2 Joe 77777 I can add and Edit any row, but I want when I click "save everyone" I rewrote all phones on DB example: 1 Steave 33333333 ...
0
votes
1answer
16 views

Can a product's attribute store several values for the same product or do I have to do something else (Magento 1.9)?

I will explain with general terms the situation: I have some products which should have 1-8 values for the same attribute and in the same product. For example: SKU 55720, Name of Attribute: Norm, ...
0
votes
1answer
56 views

Magento 2 - Add a new product attribute with values from DB

I'm looking for creating a custom attribute for products, already have a CRUD module, with name and descriptions fields, so the names from my DB should be options of that attribute. How do I need to ...
1
vote
1answer
44 views

How to delete the content of a table

I'm able to fetch the single items, or the whole tables via the $modelFactory->create()->load(ID) or $modelFactory->create()->getCollection() Using the $modelFactory, how can I delete all ...
2
votes
1answer
415 views

Custom Module data save gives array to string exception in Magento 2

I've made a custom module with a ui component in the admin. It's a grid that is filled with block data. When adding a block, and saving it in Controller/Adminhtml/Content/Save.php, exception "Array ...
0
votes
2answers
32 views

Magento updating database manually not working

I'm trying to manually update a column "term" in a table named "adyen_subscription" via a primary key "entity_id". I followed this in calling the table: Mage::getModel('namespace_modulename/tablename'...
0
votes
1answer
408 views

Magento 2 Custom Module Insert Data Issue not working

I want to save custom data from Ajax Request in my database but it's not working and not saving any data. namespace/Getquote/controller/index <?php namespace namespace\Getquote\Controller\...
2
votes
0answers
39 views

Magento 2: Best practice create model class

First thing, I have a question on this topic Optimize load model memory Then I have some questions for the best way to create a Model to load or save data to Database? Could you please explain which ...
0
votes
1answer
470 views

Magento 2: quote_address moved to sales_order_address automatically?

I created two new columns in quote_address and sales_order_address as shown below. When I first land on checkout, I manually (in the database using Sequel Pro) added '999' into the quote_address ...
0
votes
0answers
14 views

Cannot display db table content in magento 2

This is my Controller/index.php <?php namespace Wallet\Payment\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Wallet\Payment\Model\...
0
votes
1answer
806 views

Magento 2: how to save a new instance of a custom model to the database (INSERT INTO instead of UPDATE)

I have created a model and a repository to save the model, the only functions I can find in the model->getResource() are save, load and delete. The save function always uses an UPDATE statement, so ...
0
votes
1answer
504 views

How do I display data from my table in the magento frontend?

I'd like to display data from the database table on my frontend screen, I'm trying this way: Teste/Cadastro/Block/Tabela.php <?php class Teste_Cadastro_Block extends Mage_Core_Block_Template { ...
3
votes
2answers
910 views

Call to undefined method Collection::getData()

I use (Manthan_Marketplace) extension in my Magento store I want to add a table to this extension so create a custom table (photos) in Magento database with name:(manthan_marketplace_photos) Table ...
0
votes
1answer
419 views

Magento 2: Model edit form fields not loading

I've created a grid for my "profile" model. Add and delete works fine, but when I click on the "Edit" action, the resulting page doesn't load the profile's existing fields. I understand that we pull ...
0
votes
0answers
279 views

How to add , another model collection data to an array. : magento 1.9

I have response collection $customerData, i have to add referral code of selected customers in the same array, model and field of referral code is : $referCustomer = Mage::getModel('...
3
votes
3answers
200 views

How to save two entries in one table row in Magento 1.9?

I have to save In and Out timing of customer and their In and Out location, I want to save all the data in one row. I am getting status 1/0 1== In DATA, 0== Out DATA, but how to save it in the same ...
1
vote
2answers
40 views

Can´t write in ddbb from form

I make a new module which is a simply form, but i can not write into the ddbb, because (i think) can not find the model. I have this code in controllers/IndexController.php: public function ...
2
votes
2answers
3k views

Truncate table using resource model in Magento 2

I have a custom module and i want to add remove every data including the increment id, using resource model in magento 2, i've read the solution in here but this is for magento 1, i'm not sure how to ...
0
votes
0answers
543 views

Magento 2 Insert data to table that contain foreign key error SQLSTATE[23000]: Integrity constraint violation

i want to insert data to a table that contain foreign key, but it always gives me an error like this: [2017-01-18 04:45:51] main.ERROR: PDOException: SQLSTATE[23000]: Integrity constraint ...
0
votes
2answers
46 views

Saving EAV Model Causes SQL 1452 Error

I've recently started learning about creating EAV models. It's been quite the ride so far. Although I feel I'm very close right now. Currently I have created a "Vendor" EAV Model, but when I try to ...
0
votes
2answers
42 views

“Invalid backend model specified: auit_editor/customer_attribute_backend_groups” after deleting AuIt_Editor module

I've just removed the AuIt_Editor module and now when I try to log in (or create a new account), I get the following error: Invalid backend model specified: auit_editor/...
0
votes
1answer
141 views

how to store text box value in table in magento

I need to save form data in table . I need to know better way. Is it better to store from controller. i have tried using following code but no success form <form id="orderapproval-item-form" ...
0
votes
1answer
28 views

After Changing primary key of custom modules' model , does not saves data in db

I have made custom module for that I have to change tables primary key due to some reasons.I have updated it in Model\Resource\Modelclass.php file , flush cache including "Flush Cache Storage" of ...
1
vote
1answer
192 views

How to get and add Core Table data in magento2

I need to get and add a new Core table data. So, I tried based on get custom table data way(Model, ResourceModel) but it's not working for me. For example I need to collect customer_group data What ...
0
votes
1answer
780 views

Column not found Magento2

I am using magento 2.1 C.E. I have initialized my own model with a custom table. I am trying to implement mass actions and clicking on one of the massactions, I get this error: Exception #1 (...
15
votes
1answer
2k views

What is the best practice way in Magento 2 for creating Many To Many relationships?

I've looked around the core and seen a few examples of many to many relationships between models, but I can't see a definitive answer on this. As an example, say we create a new model and we want to ...
3
votes
0answers
932 views

Working with Models and Databases in Magento 2

So I've been following along with these questions : https://stackoverflow.com/questions/31983546/in-magento-2-what-is-the-correct-way-for-getmodel/31984198 https://stackoverflow.com/questions/...
0
votes
3answers
2k views

Creating a module with custom database table, cannot save

I have developed a custom module that also has a custom database table. However, I cannot insert records since I am presented with the following error: Fatal error: Call to a member function ...
2
votes
2answers
262 views

How to insert data in `catalog_category_product`?

I want to insert from magento Controller values to catalog_category_product. How do I get the model?
0
votes
0answers
60 views

Magento 2 : The proper way to read/save entities [duplicate]

I have been only for a few days in the Magento universe, starting with Magento 2, and I am currently a bit lost regarding the proper way to read and save entities (Model). At the very begginning, I ...
4
votes
2answers
666 views

How does Magento model distinguish column names in its get/set Model methods?

Let's say I have a Model associated to a table with a column called title. I understand that I can do a $model->setTitle("Hello"); to set a value to this field. I can probably do the same for ...
3
votes
1answer
6k views

How to know if Mage::getModel('customer/customer')->load() succeeded?

I want to know what if a customer ID I was trying to load was invalid. When I do this: $customer = Mage::getModel('customer/customer')->load(12345); If this customer exists, I get the data. The ...
1
vote
1answer
733 views

What is ->load(),->getData() in Magento and how does it work

$deal_m = Mage::getModel('dailydeals/deal')->load($deal_ids, 'deal_id'); $deal_m->getData() I can understand this above code will get the values for deal_id=$deal_ids from the deal table.But I ...
0
votes
1answer
1k views

Mage::getModel() fail to load my model

I am trying to learn Magento hard and although I have good understandig of OOP and programming ,still struggling.I am following tutorials ,do the same as there and got errors ,which is very ...
0
votes
1answer
52 views

Different type of way to store Database

I am using in this way to store Database $connectionresource = Mage::getSingleton('core/resource'); $connectionWrite = $connectionresource->getConnection('core_write'); ...
1
vote
1answer
78 views

Cannot persist my model to database (M2)

I have a custom model object and want to persist it to the related database table. When I try to save the model, nothing happens. In case I do not enter required fields, I get an "Integrity ...
1
vote
1answer
218 views

How to increment a column based on another column (max value) in a different table in Magento

I need to update a column based on another column (max value) in a different table in Magento. If the updated value is not greater than the max value then update other wise not. By Updating I meant ...
0
votes
2answers
701 views

How to apply limit and order by for update function of the adapter in magento?

I am trying to update a single row of my model. My requirement is I have certain conditions which will return a set of rows and I want to update only the row with the highest id (or latest). I am ...
1
vote
0answers
193 views

Can't insert data into the database in Mage_Paygate_Model_Authorizenet::_place()

folks. Help me please. How can i get information about all authorize.net failed transactions and save it to the db? I'm trying to do it like this. Make rewrite of Mage_Paygate_Model_Authorizenet::...
1
vote
1answer
424 views

Invalid entity supplied on getCollection

I made setted up a custom model but I'm stuck on getCollection methods which results in Invalid entity supplied My setup: IndexController.php Mage::getModel('custom/customerobject')->...
1
vote
2answers
5k views

Magento get read or write connection for model / resource model

I have 3 databases (in addition to the magento one) connected to magento with models (non-eav) defined for the tables. They all have their read and write connections defined in the local.xml ...
0
votes
2answers
286 views

Magento: Model not working, invalid object

All my files for reference: (with filenames and filepath) /app/code/local/Namespace/Modulename/etc/config.xml <?xml version="1.0" encoding="UTF-8"?> <config> <modules> &...
1
vote
0answers
23 views

Bit masking model attributes: Yeah or Nay? [closed]

I would like to know if bit masking a attribute in a model is good practice. To me it makes sense: Low database usage and fast extraction of the data. Maybe I'm overseeing something, so I would like ...
1
vote
0answers
187 views

Mysql Query to Create a custom report

I am writing a query to export a custom report regarding sales. The following tables are in question sales_flat_order sales_flat_order_item sales_flat_shipment_grid I haven't worked much with ...
1
vote
1answer
694 views

Raw sql query vs Mage::getModel('catalog/product') vs?

I want to optimize simple ajax call which retrieves product information. Just getting product information will take 13MB of memory: require_once('app/Mage.php'); Mage::app('default'); $_product = ...
2
votes
1answer
370 views

Convert normal mysql query with math functions into magento model format

I have the following query in MySQL. I need to convert it for magento. My query is, SELECT latitude, longitude, SQRT( POW(69.1 * (latitude - [startlat]), 2) + POW(69.1 * ([startlng] - ...
0
votes
0answers
1k views

Custom database table - can't add new row but updating existing row works

I have created module which add new custom table to database and should store there 3 informations: order, transaction id, status I made my install script and everything was okay, table is created ...
1
vote
0answers
497 views

Incrementation in model's setData()

I'm looking for a way to add 1 to count in the model. Something like: $model = Mage::getModel('mymodule/mytable'); $model->setData(array('date'=>$myDate,'hour'=>$myTime,'count'=>'count + ...
6
votes
1answer
5k views

Fatal error: Call to a member function beginTransaction() on boolean in /var/www/html/app/code/core/Mage/Core/Model/Abstract.php on line 313

I'm getting the following error after moving a Magento 1.9.1 project from my local Vagrant box to a remote server: Fatal error: Call to a member function beginTransaction() on boolean in /var/...
5
votes
3answers
25k views

Model save using setData and addData not adding to database

I have a model and I was trying to add a model to the database. When I execute the php script to add everything works fine and no exception are thrown. But the data is not added to the database, which ...