I've been stuck on the proper way to do this for a while. I want to add a new page to the Magento user account on the front end after log in/creation. There is some information we would like to gather from our customers separate from account creation. The page needs to be dynamically generated, as it will pull information from the database, so CMS is not an option.
I know there's a template .phtml file I'll need to create. I also know where to override customer.xml to have the link show up.
But, I have NO idea how to make the page show up (I can add the link, but it goes to 404). I assume there's some sort of xml reference to associate url to file, and the template to use. If someone can point me in the right direction, I can probably reverse-engineer the format.
I also don't know how to properly use Magento's existing functions to grab the information on submit. I want to show the same page after submission, with info in fields ready to change. Can I/should I just use the same .phtml template file to process the form submit?
Thanks!
Create a custom phtml page with your desired functionality.
Create a cms page and call the .phtml page from within it as
follows,
{{block type="core/template" template=".../.../yourcustom.phtml"}}
3.Your problem solved.
I think you have a fair idea on how to handle the cms page to get your desired functionality.
You can customize the phtml file of account information page ../customer/account/edit/
but to force filling this form you need to make module and add observer controller_action_predispatch and add method that check for the data you want and if not redirect them to the account information page
Related
I am trying to add custom sections to the homepage in between product rows, which include products filtered with custom queries not provided by default from CS-Cart.
The usual way of doing this via code (the project is customized to the point that CMS functionality in this case doesn't help) is to do some logic in the proper controller and assign the data to the view.
By researching I know that the index page is handled differently from the other pages meaning that it doesn't follow the controller->view pattern.
How is the index view (homepage) handled on the back-end? Where is the logic for the index page and how do I edit it to customize my homepage?
On backend > homepage CS-Cart follow the same pattern and the files are:
php
app/controllers/backend/index.php
To add your own php code you can add it by adding into file
app/addons/[ADDON_NAME]/controllers/backend/index.post.php
tpl
design/backend/templates/views/index/index.tpl
Please check tpl file because there are already available some hooks
you have to edit config.local file with this code
$config['customer_index'] = '<Your_new_index_path>';
In the Wordpress Menus Custom Links, I want to create a page called "My Page", and when the Current User clicks this Custom Link, it takes him to his specific page.
E.g mydomain.com/%CURRENT USERNAME% /
mydomain.com/johnsmith
Reading other posts, it appears that the Wordpress Custom Link understands only a static URL, not a dynamic one.
Therefore I need some way for the system to "get" the current user info, and redirect accordingly.
I have viewed the replies at this previous thread and here but I am still lost.
My coding ability is even less than the first guy's (but I do try!), so I can understand the theory, but I don't understand the technical language.
Therefore, I understand "You need to place this code, in your Theme Functions/in the script of the page".
But I don't understand "You need to run a jQuery with this code"
What information can I enter in the Custom Link to achieve this?
What code do I need to enter in the back-end to read this information correctly?
Thank you very much.
In the pages .tpl.php of my theme i can find several lines like
render($action_links)
displaying whole pages with a single command. Sometime i saw that the render argument is a block from my theme .info, but other times i see arguments i cannot identify that render default pages or elements of drupal.
How it works? And where i can find a list of default displayable pages?
In particular, i needed to display the content of the default drupal page "add content" in one of my pages, and i'm pretty sure i can do it using this render method, but i cannot find the correct argument.
EDIT: I found something like
drupal_render(node_add('NODE_TYPE'));
that seems to allow the display of a node add form, but what i need is the main add content page, containing the list of all the type of nodes that a user can add.
Are you new to Drupal? When I read your post, I'm almost sure that you have missed something with the Drupal's working. The variables you found in render() functions are "calculated" somewhere else in the code (in the modules part for the most).
You cannot find a list of constant variables to display them just like this.
I found this article about these mysterious variables that are rendered and I hope it will help: http://newsignature.com/articles/the-magic-behind-drupals-render-elements
If you just want to display the "add content" form somewhere on your site, just call its path (node/add).
EDIT AFTER CLARIFICATIONS:
First of all, you can set on which page you want the user lands after login. (I don't know why you're still talking about user profile template. Maybe I missed something again.)
But if I did understand what you're trying to achieve, I'll do that:
Create a menu (or simply use the "Navigation" menu that seems to be exactly what you need) with all the actions users can do. And I'll place this menu in the main content region. Do create a menu, go to Administration>Structure>Menus>Add menu. And add links like "node/add/article" or "node/add/news" or "node/add/page" or whatever your content-types are.
Place this menu in the region you want. If you want it to be like the main content of the page, place it in the main container. To do so, go to Administration>Structure>Blocks> Drag and drop your menu in the right region and Save.
Configure this block to appear only on the front page (the first page on user arrives after logged in) if you want so. To do so, in the Blocks administration page, click on "Configure" next to your block and check "show block on specific pages: Only the listed pages" and write down <front>
Create roles and permissions for your different sorts of users. That will automatically show them the links they are allowed to see. To set permissions, go to Administration>People>Permissions and check in the "Node" section which content-type each role can create.
I hope I didn't forget anything. Please tell me if it is clear enough.
I've installed Drupal to have a basic user registration layer. Now I need to code some PHP code in a blank page, how I can achieve this in Drupal? I need to know where I must put my PHP code.
Thanks a lot
Edit.
Basically I need Drupal only for user authorization. After a user logged into the system I want to show him a table with some data. This table was managed with JQuery.
for what you want to do I think it's not necessary a custom module, but if so, it's not so hard to do, but you can allways use some existing drupal modules mixed together to do what you want.
You will need:
Display Suite and
Login Redirect module
Basically I need Drupal only for user authorization. After a user
logged into the system I want to show him a table with some data.
For this purpose you can use Login Redirect module to redirect user to any page you want.
Now I need to code some PHP code in a blank page, how I can achieve
this in Drupal? I need to know where I must put my PHP code.
For this you can use Display Suite. Display suite or simply DS comes with a new a new Text Format: "Display Suite code". This text format allow you to add some custom code to your pages (javascript,php,etc)
you should learn to develop Drupal modules
with hook_menu you can make page
and with hook_form_alter you can edit registration form
but in drupal 7 you can manage registration fields
and also with rules and views modules, you can manage registration and user list without PHP coding
You will have to create a module in order to add php code to drupal. Try this to understand better what u need to do https://drupal.org/node/1074360
I'm new to Magento, and i need some conceptual guide and/or references.
I need to create custom form that will be a part of product-info page (at it's bottom) and that will collect user input (email, size, color). Only some product will have this feature/form (it's up to admin). So, goal of this form will be to email store-admin about a product that is available in stock but not in wished size and/or color. Should i customize existing Contact us form or should i create fresh custom form in new module?
Form should submit data to admin via email along with name of the product.
Ok, so first create a .phtml file under app/design/frontend/[namespace]/[theme]/template/catalog/product/send_request.phtml
then, add this .phtml file reference in catalog.xml in /app/design/frontend/[namespace]/[theme]/layout/catalog.xml
<block type="core/template" name="customer_request" template="catalog/product/send_request.phtml"/>
below the :
<label>Catalog Product View (Any)</label>
section but you should find to right section where to place ( you will find after a few try )
Finally, add your php logic into send_request.phtml file. The form contain that you implemented in send_request.phtml will available under product view page.
Sounds like you'll need a custom form. You'll need a new database table to store the data, a Model to represent the data, and a controller to post the form to at the very least. You'll probably want to add an attribute to Products which is a yes/no of whether to display the form. You'll also probably want to view the data, so you'll have to make pages in the admin site. Perhaps a grid of all answers and a page to view/edit a specific answer.
There is a free extension available. You can use this extension and customize it according to your needs. Product Questions