Execute php script after saving Joomla 3x form - php

How to execute a PHP script after saving a form data from Joomla 3x Banner component?
What I want to achieve is to run a push notification after saving ads in Joomla banner component. The push works well when I run it off Joomla platform, but I don't know where to place the code so that it can execute upon saving the form.

You will need to override the save method of the banner's model. Here's how you can override the model: https://docs.joomla.org/How_to_override_the_component_mvc_from_the_Joomla!_core
Once you override the model, you will need to modify the save method of the overridden file to suit your requirements.

Related

Custom joomla Component to load data

I am new in joomla. I am working joomla component which was developed by other coder. I can edit page view, data etc which is displaying on page. But I am unable to find from where I can edit data which is coming from default. There is controller table in component, but if I remove controller folder still its loads.
In my one of view file I put this
print_r($this);
die("");
It prints all the data which is related to this component. I want to find code from where this data is coming so i can edit that data as per requirement. Its all only one view file, because controller folder in this component is removed.
This is somewhere in joomla main files.
Thanks
it's a bit hard without seing any code, but assuming the original author followed joomla standards, the data comes from the model having the same name as the view.
e.g for com_xyz/views/viewa/view.html.php, the model would be com_xyz/models/viewa.php

Custom Customer Edit Page: Upload PDF file and retrieve for display

I followed this tutorial Add Custom Edit Customer Tab to create a custom tab and page for my customer.
I would like to make it as dynamic page that fetches data from the database however I don't know how to start it.
So far this is my progress
All the codes were copied from Add Custom Edit Customer Tab.
I'm new to magento and I don't now how to start creating a dynamic page in the admin page.
My goal is to upload a PDF file for every customer and display it below.
UPDATE: My goal is to create a magento module that allow admin to upload pdf file in the backend and will dynamically display on the customer login page.
I would like to know were can I create/relate my database table/attribute so that it will get and store the exact customer ID and file.
Is there any tutorials or blogs that you can recommend?
In case I will create another similar customer page that uploads PDF file, is there a way also that I will not repeat my self doing the same code?
I hope you can help me.
Thanks!
The best way to solve that problem is to understand how to create a simple module.
Allan Storm has one of the best blogging tutorial that can help you.
If you already understand the basic of Magento module you can advance in making complicated admin backend.
You can start by building Magento Admin Grid.
You can start on this tutorial http://navaneeth.me/creating-magento-extension-with-custom-database-table/#.VkwhrXYrKUk upon following, update the rosource model and collection model, extend them with this
Mage_Core_Model_Resource_Db_Abstract - (extend this on your resource model)
Mage_Core_Model_Resource_Db_Collection_Abstract - (extend this on your collection model)
To create upload file, try to understand this link http://arabgento.com/en/techniques-of-uploads-files-inside-magento/
don’t forget to declare your from container with (‘enctype’ => ‘multipart/form-data’)
I hope this helps.
For upload pdf and display it :
If you want to display pdf than use use "iframe" tag.
If you want to convert pdf to png or jpg and display than upload the pdf using AJAX on server and convert that pdf using "imagemagick" and display.

How do I get field data in Magento from a custom module?

I'm very new to Magento development (this is my first module). The purpose of this module is to fix some problems that we are having with the original one, while not making any changes to the model/controller. I am modifying this existing template, but I cannot seem to find a way to retrieve fields. The template is using:
$this->getChildHtml('submit_button');
to submit the data. This is ultimately making a call to a javascript/ajax function that pretty much leaves me at a dead end. I'm simply wanting to get the values of, let's say:
<textarea name="thing[other]" .../>
How would I retrieve that value so that my Model may manipulate it? Overriding the controller is not an option, this page is essentially a duplicate of another that uses the same controllers. The functionality of that controller is desired for that one, just not desired for this one.
or
My other option is to override the template. My problem with that is that the original module is using an observer to override the template, and I'm not sure how to override that.
You need to create a controller and set the form action to post to this controller. You can then access the post data by calling :
$postData = $this->getRequest()->getPost();

Using multiple form field widgets for the same field in Drupal

I would like to be able to use multiple form field widgets for the same field and to be able to switch it based on session data from the user. But I am not really sure how to accomplish this. This is for Drupal 6. Any ideas on how to accomplish this?
You might be able to accomplish this with one of the field access modules but to do it properly you'd probably need to create a custom widget. Your widgets can return existing widgets by calling their handles, so your widget would more or less be a wrapper that returns the correct widget call.
this tutorial gives a pretty good overview of widget creation in Drupal 6.
What I ended up doing was creating a second form field that uses the filefield upload widget and loaded it on the form alongside the Flash widget. Then I put JS on the page that detects if Flash is on the page and is of the correct version. If it is found then it hides the html/AJAX uploader. If it is not then it hides the Flash uploader.

How do I create the widget automatically on PyroCMS?

I'd like to develop a module as an event with registration form. An event is actually a page module with slight modification by adding some fields such registration form url. When the controller return a view, I'd like the controller to return a registration form widget along with the event info (article) and a google maps widget.
Imagine a widget class:
<?php
class Registration_Form_Widget extends Widget{
......
}
My question is:
Is it possible to create widget dynamically (I mean the creation of widget instance is dynamic (not the content) such using new Registration_Form_Widget and bypass the parameter such the registration form url that has been stored to the database?
So far, I never see an example that show how to create widget instance dynamically with automatic increment id
thanks...
Nope, widgets are created whenever you create em.
Although it is obviously possible to achieve it with a bit of code.
There is no "magic function" to do that automatically, but you can look into the widget module files to understand what is done when a user create a widget in the admin CP. And then you could reproduce the behaviour yourself.

Categories