2 problems and 1 question

Problem #1: I’m developing a plugin for a website with Shopware and whenever I have the jQuery code appended with the other .js files, clicking on the cart button would start loading forever and never actually display the popup. I initially thought it could be the jquery code breaking it but it seems the code content itself has no effect on whether that will happen. In Firefox’s Javascript console, I had this show up “TypeError: jQuery.controller is undefined” whenever I’d click on the cart. So, I’m not really sure what I’m doing wrong. Problem #2: I’m trying to set up a custom dropdown “select” box with a custom arrow but the problem I’m facing here is that whatever customization I try do to the box, the default dropdown arrow is still there and wouldn’t be replaced by whatever I try to set it to. Question: So, in this plugin I have 4 items’ IDs that are added to the database and then the info for each one should be fetched. 4 images with the respective item’s name are then displayed in the plugin and upon clicking an item’s image or its name, the rest of the item’s info should be displayed. I’m not entirely too sure how to approach this for the plugin. My idea is to make a function (e.g. “getItemInfo($itemID)”) that will return an Article object with the loaded details and then have all needed item info in “data-DETAILNAME=”, which will then later be loaded upon clicking. Now, the problem I’m facing is that I’m not too familiar with how to load this data from Shopware, so I’ll really appreciate, if someone is able to help me here. Thanks! Regards, Djulio

333 views, 0 replies lol Anyway, I kinda managed to get the problems sorted myself but I still have the question left: [quote=„Djulio“]Question: So, in this plugin I have 4 items’ IDs that are added to the database and then the info for each one should be fetched. 4 images with the respective item’s name are then displayed in the plugin and upon clicking an item’s image or its name, the rest of the item’s info should be displayed. I’m not entirely too sure how to approach this for the plugin. My idea is to make a function (e.g. „getItemInfo($itemID)“) that will return an Article object with the loaded details and then have all needed item info in „data-DETAILNAME=“, which will then later be loaded upon clicking. Now, the problem I’m facing is that I’m not too familiar with how to load this data from Shopware, so I’ll really appreciate, if someone is able to help me here. [/quote] Any help would be appreciated!

Hi Djulio, very often splitting up the problems / questions into separate threads is helpful: Its more obvious to the reader what the questions is about, you can pick a more „meaningful“ thread title and generally it makes the discussion less messy (ok, in this case, the number of answers was quite managable :)). Regarding your question: [quote]Now, the problem I’m facing is that I’m not too familiar with how to load this data from Shopware, so I’ll really appreciate, if someone is able to help me here [/quote] What exactly do you need to know? Are you looking for Shopware()-\>Db() for general database access? Or for Shopware()-\>Models()-\>getRepository('Shopware\Models\Article\Article')-\>getArticleImages() for an existing query? Or don’t you know how to hook into the system? Perhaps you can show us, where exactly you are stuck - this will make it much easier to help you. Best regards, Daniel

Hey Daniel, first off thanks for replying and sorry for the title, I guess. So basically, here’s what I’m trying to get done and if possible, you could guide me for the best way to accomplish this for Shopware, as I’m rather new to the whole thing :confused: I have set up a plugin that has 4 fields for the admin to enter 4 products by their ID or OrderID’s, example field names - item_id_1 item_id_2 item_id_3 item_id_4 What I want to do is to get those values from the database in the plugin, fetch the information for the articles associated with the id’s (probably in an object?) and have that data then assigned to variables. For example: assign(„item_1_image“, $item_1_image) assign(„item_1_name“, $item_1_name) etc Afterwards, I’ll have the assigned values appear in the template that I’ve set up. Any help/tips would be greatly appreciated! Regards, Djulio

Hi, did you create an own module or are you using the shopware config forms for this? If the later is the case, you can simply read the Id with e.g. $id = Shopware()-\>Config()-\>get('myConfigName'); Having this, you can query the article with e.g. $article = Shopware()-\>Models()-\>getRepository('Shopware\Models\Article\Article)-\>find($id) From your controller this can now be assigned via $this-\>View()-\>assign('article', $article); Best regards, Daniel

1 „Gefällt mir“

Hey, sorry for the late reply. I’ll try to get into more detail on how I’ve set it up: I have set up a plugin which when activated, enables the user to add the module to the “Shopping Worlds” and upon clicking “Edit”, they can set the 4 ID values for the 4 shop items there. The text fields are created in the plugin’s Bootstrap.php via the createComponentFields() method. Example: $this-\>component-\>createTextField(array( 'name' =\> 'fp\_item\_id\_1', 'fieldLabel' =\> 'Item 1 ID', 'supportText' =\> 'ID of item #1 to be shown on the front page.', 'allowBlank' =\> false )); I read that in the template, I could get the data for the field with $Data|print_r (for all) or the component directly with $Data.componentName ($Data.fp_item_id_1) Afterwards, I want to assign the different data that is fetched to the variables that are then used in the template and I’ve put the vars currently like this: // Item #1 $view-\>assign('item\_1\_id', "1234"); $view-\>assign('item\_1\_title', "Product #1"); $view-\>assign('item\_1\_image', "none.jpg"); $view-\>assign('item\_1\_descr\_1', "Description1"); $view-\>assign('item\_1\_descr\_2', "Description2"); $view-\>assign('item\_1\_descr\_3', "Description3"); $view-\>assign('item\_1\_descr\_4', "Description4"); $view-\>assign('item\_1\_price', "1234,00");

my website default language is vietnamese when i pass url english then this url redirect to home page so i want auto change language when pass url please help me!