Maintaining a Magento site built by someone else, noticed the site owner had not populated Meta Title, Description & Keywords on a product level. The default meta-information for the site populates into every product page.
After successfully populating these attributes for the store view, clearing cache, re-indexing, verifying the attributes are active, etc., the default meta-information for the site is still what populates the product page.
Seems like it would be a configuration issue, but at this point I'd like to rule out the chance that the original developer altered the core functionality somehow. I see where the getTitle() method populates the default meta-information when it can't find something more specific, so that's cool and it's doing so because there is no data for the title when it's rendering the page.
Where would I find the method that creates/populates data for the product object when building a product page?
If I find where that happens, I should be able to test for what is coming out of the database directly.
Or, if by reading this you realize I've missed checking a config option, would love to hear about that, too.
The product meta titles are set in Mage_Catalog_Block_Product_View in the _prepareLayout() method
See here
Related
I am using wordpress posts with multiple custom meta to display may items. The items are searched for and added to a collection (or cart) This resembles a commerce solution which are widely used in wordpress I don't understand where they store the variables while the user continues to shop.
To expand further the user will search for items when they see the item they want they can click on it to open a detail view in a modal. Add some specific information (meta) to the item and then ADD to collection. They will then search again for more items and perform the same - all the time building their collection.
Once they are happy with the collection they have created they move to the publish page where I need to output the contents of the collection into a template of the users choice.
The main problems I am facing is being able to add the post ID's and modified meta to local storage / DOM / $_COOKIE etc, some advice on the best solution would be great.
I have searched high and low and I cannot find anything that does this without getting bogged down in useless ecommerce features.
Many thanks
The easiest way to do this is probably to set cookies. The fantastic jQuery.cookie plugin found here makes this a piece of cake - setting and retrieving cookies just takes one line of code:
To set:
$.cookie('cookiename', 'cookievalue');
To retrieve:
var whatever = $.cookie('cookiename'); // assigns 'cookievalue' to var whatever
You can also set them to expire after a set amount of time, etc (those are session cookies above). If you need to store arrays (e.g. of post IDs or meta values) the plugin also lets you store JSON objects as cookies. See the documentation on the page I linked for details.
I am creating my first wordpress plugin. In it, the user will have the option to add new cities and view events on those cities.
My client requirement is that the URL must be like this
SITE_NAME/cities/NY
or
SITE_NAME/cities/Califonia
What is decided is that i will create a folder cities and If user tries to create a new city i will create a file in that folder with that city, Further more I will add the entry into the database as well.I will insert PHP code into the file as well.
Being new to WP plugins. Is my approach right (for creating files)? Is there any other way?
Your approach would work if you WEREN'T using Wordpress, but I would absolutely not advise doing what you're suggesting within the Wordpress Framework.
Rather than trying to reinvent the wheel, just about everything you want can be achieved with existing Plugins. I would absolutely suggest taking this route, especially if you don't have much experience with programming Wordpress Plugins.
Step 1:Install Wordpress
Self-explanatory. Can't do anything without this.
Step 2:Install Types
Installing the Types Plugin will give you a nice interface for registering your own Custom Post Types and many other features for extending Wordpress' core capabilities.
Step 3:Register your Custom Post Type
This is where things start to get complicated. Using Types, Register a Custom Post Type called Event. The reason why you want to have each event as its own Post is because each Event is unique. Cities are meant to encapsulate and define groups of events, which brings us to our next step:
Step 4:Register your Custom Taxonomy
Think of a Taxonomy as a way to classify things. Wordpress comes with two default Taxonomies: Categories (hierarchical) and Tags (non-hierarchical). In your case, you will want to define for your new Event Post Type a non-hierarchical Taxonomy called "Cities".
Step 5:Register your Custom Fields
Custom Fields are the easy part. What defines your event? Maybe some fields that define the start and end times of that particular event? A checkbox denoting free refreshments? The sky's the limit. What defining characteristics would all Events have that makes it an Event? Add those in the form of Custom Fields. These will show up on your Event Editor in the form of Meta Boxes. If you don't see the Meta Boxes on the Edit Page for a particular event, be sure to enable it by clicking Screen Options in the upper-right-hand corner of your screen and ticking the checkbox where your fields would be located.
Step 6:Configure your Permalinks
Much of this can be done either through Types itself (when configuring your Custom Taxonomy), or through .htaccess rewrites, or perhaps even through the Wordpress Permalinks Settings (though, it's fairly limited). My suggestion is to tweak your Custom Taxonomy and Permalink Settings first before messing with .htaccess.
And that's it! Hopefully this should be enough to get you started on everything you need.
maiorano84 wrote a fairly comprehensive guide to setting up the stuff you need, Rather than relying on plugins though, I prefer to show you how to write a plugin to register the custom post type and taxonomy. To that effect, I wrote a little plugin that should do everything you need and it has plenty of comments and links to the docs so that you can understand the Why of things.
Code
https://github.com/fyaconiello/WP_Cities_Events
This plugin does several things
Creates a custom post type Event
Creates a custom taxonomy City
Adds custom metaboxes to Event
Adds City taxonomy to Event
This plugin does not require any additional plugins to be installed, it is dependency free and only uses WP core.
URLS
As far as getting the correct URL Structure, I would suggest you read this thoroughly: http://codex.wordpress.org/Using_Permalinks.
I do not understand the structure you want
CITY is a single term w/i the taxonomy *cities*
EVENT is the post single
SITE_URL/cities/CITY would yield a page of all EVENT posts in that CITY
you need a url like: SITE_URL/cities/CITY/EVENT to read a specific event in a specific city
EDIT on how to urls:
In your Settings -> Permalinks administration panel select: "Post name" and save.
Then, go to your Ce Events -> Cities admin screen.
hover over one of your terms (in my case new york city) and click view.
it should open up that term(city)'s list view and the url structure looks like so: http://wp.local/city/new-york-city/
if you need city to read cities, modify line 102 of the main plugin file i shared with you:
'rewrite' => array('slug' => 'city'),
EDIT 2
Why not create City as a Custom Post Type? You can then define a slug 'cities' and get that result, and also add taxonomies like categories and tags to further aid navigation.
Don't do that. WordPress gives you a goog API for doing what you want to do: managing pretty URLs (slugs), database operations (you don't need to write/read files for that) and the right code workflow for registering and triggering actions.
So, I think you have to start reading the basics about WordPress plugins (its philosophy and API) and then just decide if you want to use its custom post types (ready to use) or if you want to create a specific content type.
yes this is fine approach.One more thing that you can do is that instead of adding the code inside the fie..Pick the code from DB.
Make a table in DB,create a column with varchar as datatype and insert the common code in it .
i'm building a website for a house builder and each house plot (k2 item) has a few extra fields associated with it such as 'price' and 'availability'.
i would like to display this extra field data elsewhere on the site perhaps in a table that lists 5-6 plots and displays their current price and availability.
the idea is to be able to change the price of a house in the extra fields section and then have this change reflected in other parts of the site that call on this extra field data.
i've read this article..
http://jurawa.com/notes/item/27-update-making-k2-more-like-a-true-cck-custom-admin-templates-and-calling-specific-extra-field-data
..which explains a process of displaying extra field data but i've not managed to get this to work. i also think that this method would only work if displaying extra field data while already inside the item that it relates to. i'm trying to display this extra field data around other parts of the site.
i'm trying to replicate something like the table that appears on this page (just above the map)
http://www.orionhomes.co.uk/development/brunswick-place
running the latest version of jooma and k2 and have full access to server and database.
hope someone can help..!
many thanks
I have used the Raxo All-In-One module to accomplish this in the past:
http://www.raxo.org/raxo-all-mode-k2.html
This, along with ability to insert a module in an article, would allow you to place the specific K2 content/fields wherever you need them and have them updated dynamically by K2.
Another option would be to create a new template for K2 and only output the extra fields in your item list. This would allow you to create the table view you are looking for.
There is a great plug-in for Joomla/K2 that does this for you at:
http://joomcar.net
It's called K2 Filter and Search Module and it will display a table with the extra fields as you have demonstrated in at:
http://www.orionhomes.co.uk/development/brunswick-place
You can definitely display those extra fields wherever you need them on the site.
This step-by-step tutorial may help you to create the extra fields.
Then you just need to enable the extra fields in your view and modify your template.
I have a client who has a magento site that loads custom category pages and on one of them $this->getChildHTML('content') is dumping out a bunch of code after it loads the page. it's only on one page and it looks like its dumping out php closing tags.
getCurrentCategory()?> getCurrentChildCategories()?> count()):?> getIsActive()): $cur_category=Mage::getModel('catalog/category')->load($_category->getId()); $layer = Mage::getSingleton('catalog/layer'); $layer->setCurrentCategory($cur_category); $catName = $this->getCurrentCategory()->getName(); if($_imageUrl=!$this->getCurrentCategory()->getImageUrl()):?>
getCurrentCategory()->getImageUrl()):?>
getName()?>
setCurrentCategory($_maincategorylisting); ?>
I can't seem to find the page that has the error on it. I don't know where 'content' in getChildHTML is located. the category pages were made custom, and doesn't show any products, just an image of one of the products. i'd like to change these pages to show products and a whole bunch of other stuff, but i just don't know where these custom category pages reside. there are custom templates for each category, but they all use the same getChildHTML('content') call...
i tried downloading the whole site and doing a text search for bits of code on the category page, but found nothing. please help!
btw....if you could already tell, im new to magento and probably left a lot of important info out, so if you think i need to post more info, please say so.
thanks in advance!
"content" is the name given to a block which is defined in page.xml as a core/text_list (Mage_Core_Block_Text_List) block. The purpose of this block is to echo any child blocks assigned to it, and it does this without a template. Any layout file as well as layout updates in the database (see any category's Design tab) can contain instructions which are included on category pages and modify the children of this block.
See Alan Storm's knowledgebase article on MagentoCommerce.com and eventually graduate to his exhaustive book No Frills Magento Layout.
For general information you are in good company at Stack Overflow, and you can also rely on Magento U as a resource.
That depends on the theme, any extensions, and other custom code. Typically, getChildHTML('content') loads the "content" handler for the current layout. This could either be directly in catalog.xml, local.xml, or if it's an extension override, the extension's xml. It could also be a layout update in the Category itself on the backend.
Use Magento's debugging tools to output each block and their location from the Admin:
System -> Configuration
Change 'Current Configuration Scope' to the website view
Advanced / Developer
Debug panel: 'Template Path Hints' and 'Add Block Names to Hints'.
You can also add your IP address to the 'Developer Client Restrictions' section above it to limit this output to just your own IP. Once you save it, you'll see a lot of red-outlines.
View your broken category page and find the filename that wraps around the broken code.
I'm wondering if anyone has found or written an extension that would allow a magento website administrator the ability to add values to their products attribute while adding the product. For example, if I sell books and want the book author to be in a drop down list so that it would be used in layered navigation, it seems odd that I would have to add the author via the attributes section before adding the product. From a workflow standpoint it really makes sense to have an "add new value" button next to the drop down on my add product screen.
Anyone have any thoughts or insight?
It's a piece of cake to do, if you know jquery and the (if I may guess) extremely simple model behind magento.
As the other guy said, throw some money and I'll do it ;)
Otherwise, real easy -> find where that dropdown is generated, add a button next to it that opens a popup which you fill "create a new thingie" stuff, create button -> +create +close +refresh your dropdown.
Definitely easy.
And considering the attribute dialog already exists in the tool you cold probably take most from there and just add the popup handlers / button / +refresh .
This extension can Import/Export products and customers from/to CSV file. Create categories, add attribute options, import images and media galleries, reindex, refresh cache, media and price rules automatically. In addition you can backup the entire database in SQL format.
So from above, once you make the csv file, you just have to add the Author header and it would build the list from there. However, the attribute must exist first. I am using this method for the creation of my own manufacturer attribute options.
AMartinez_CustomImportExport
Can't say I have, but I've developed something similar that creates an attribute and adds it to multiple products, it's completely possible, you just need to add something that will call the add attribute on the add product page or change the new product flow to allow a new attribute and add it if needed.
Don't let them scare you, it's not as hard as some people might describe :)
My curiosity finally took over my laziness and I managed to create the module author requested. It's available on github.
Please feel free to check it out and update it if you wish. Maybe in some near future I'll post it on Magento Connect, if feedback is good.
Here's some code that checks if an attribute value exists and adds it if it doesn't: http://www.magentocommerce.com/boards/viewthread/26234/
Shouldn't be too hard to integrate it with the "Add product" form.