Create Magento Configuration Dynamic Field like the one here http://mustakarhu.com/blog/dynamic-input-field-in-magento-admin-configuration/ - magento

I need to create a dynamic config field for magento module like the one explained here http://mustakarhu.com/blog/dynamic-input-field-in-magento-admin-configuration/.
The article is good but very brief i could not make that work, can anybody provide me some working example or point me to right direction may be another article with detailed explanation.
Thanks.

Related

Smarty getting page content

I need to edit a page on prestashop, I've found that code
<ul id="idTab2" class="bullet">{$agencies->content}</ul>
And where should i search for that $agencies variable ?
I have found the text which is being displayed into that place in CMS.
However I'd that variable need to be define somewhere, am I right ? Anyone knows where should i search for that ? I'm new to prestashop.
Why am i asking for this ? I need to add another page for example
<ul id="idTab2" class="bullet">{$test->content}</ul>
- but I can't just simply add another page called test.
The {$agencies} variable is being set in a object derived from either the Controller or Module classes but to be honest it looks like you're working with code that has been customised (via a class override or a module) making it impossible to provide a definitive answer to your question without knowing more detail.
If you can locate the term 'agencies' in a file located under \controllers, \modules or \override in your installation, then you will be closer to finding your answer. It will be contained in a function call similar to:
$this->context->smarty->assign('agencies' , [some-variable]);
Note that the parameters to the function may also be passed as an array for multiple assignments.

Magento, add a custom attribute to a customer address

I'm looking for a way to add a drop down for a customer's address (during registration, editing, checkout, etc..) that indicates whether or not it is a Residential or Business address. I have spent hours going through tutorials but they are all out of date or poorly written. I have read 6 different ones telling me how to do the same thing 6 different ways. Can someone outline a simple process that you need to do in order to add a custom attribute to an address? I'm on Magento 1.6
Try something like this tutorial at Fontis: Know More About Your Customers - Adding Custom Signup Attributes
Whilst this was written for 1.3.2.4, most (if not all) is still relevant for 1.6. I've done a very similar thing by allowing a customer to choose the customer group they wish to belong to, by following these directions.
Oh, and there are some great comments on the post as well.
These tutorials should give you a good idea how to do what you want:
http://www.unexpectedit.com/magento/add-new-customer-attribute-onepage-magento-checkout
http://www.excellencemagentoblog.com/magento-adding-custom-field-to-customer-address
Best regards

Sorting a view by dropdown

Hey, i've been looking around for a ajax dropdown sorter for my Views in Drupal.
Unfortunatly, i haven't found alot of usefull information about this subject.
Can anyone tell me if theres a solution already available or can help me started on a custom module by telling me which hooks i should use?
I had a similar issue. Unfortunately I wasn't able to sort the data from the database which is by far the best way. I was however able to take the data and sort it with PHP using a preprocessor function. Depending on the name of your view, setup a function similar to the following:
function templatename_preprocess_name_of__view(&$vars)
{
//Super sweet sorting code goes here
}
The name of your view needs to follow the name of the template file that it is driven by, if there isn't on you should create one. Make sure to change dashes to underscores in your function name. Hope this is helpful. If you find a way to do it from the DB I'm all ears because that would be super awesome.

how to add more simple products into configurable products using magento API

How can I simply add new simple products incrementally to configurable products?
or do I still need to retrieve the 2 original arrays of the pre-defined configurable product (getConfigurableAttributesData and getConfigurableProductsData) first, append the new arrays and set them again? Is it worked for my case just as the first-time creation?
And if the new simple product owns a new attribute / attribute options, do I also need to create /edit the attribute first before adding?
Thanks in advance!
The API as it stands does not have the functionality to do this.
Your options are:
Extend the API. (Hours of fun)
Do it with Magento methods in your own module or standalone code that includes Mage.php.
SQL script mixed in with your existing API code.
Buy someone's module - (Hope your German is good)
The approach you take also depends on your SKU naming scheme, if you have a simple BASECODE-SIZE-COLOUR type of scheme then the SQL option can work a treat, and in next to no time, but will be heavily scorned on by Magento evangelists.
That means you are probably going to have to write your own code. Here is a very useful site that should help get you started:
http://www.ayasoftware.com/
As well as being able to import configurables (by a variety of means including SQL) there are also snippets of code useful for updating superattribute price differentials. No readymade complete solution, but, you may need to roll your own anyway depending on your SKU naming scheme.
Whilst you are at it you may also want to write some code to find simple products that are not hooked up to anything when they should be, i,e. the ones with no visibility.

Wordpress: How do I convert a generated URL (permalink) to a pretty URL?

In a plugin, I am generating a paginated link to a category,
i.e. http://localhost/?cat=17&paged=5. The category is known by slug and id.
Is there a way to have this URL converted to the user defined "nice permalink" format,
i.e. http://localhost/category/foo/page/5?
(Assuming we're running Wordpress 2.8/2.9+)
Edit: Since there are some misunderstandings about what I'm trying to achieve, here's what I have:
The category ID
The page number (i.e. the fifth page of that category's archive)
With these data I can create the URL to that page, which would be, for example, http://localhost/?cat=17&paged=5, and that works well. The problem is of a visual nature: If the user has pretty permalinks enabled, then this won't fit in very well.
Question is: How do I get the correct, pretty permalink (i.e. http://localhost/category/foo/page/5) from (or for) the information I have?
Edit 2: Obviously if a user has pretty permalinks disabled, then there are no pretty permalinks. I know that, and that is really not subject of the question ... For the moment, let's just assume the user has an arbitrary permalink setting. I generate a link, and it should look like the user wants it to.
Have you looked at the WP_Rewrite?
Does All In One SEO meet your requirements? I actually bought the "pro" version for like $30 USD and it was well worth it.
My Wordpress installation (2.9.2) does this automatically - canonical URLs have been built into Wordpress for some time. Maybe your plugin is disabling this feature?
I'm guessing you already figured it out but I just wanted to put this out for others. I think I understand your situation. If I've read your question correctly, changing admin permalink settings does not apply.
You can get the category ID then use get_category_link() function to get the 'pretty' permalink. Then append the pagination to the end.
You could explode the permalink to get the category ID and pagination number, then use the step above to put it together.
Is this what you were looking for?
The correct way to generate the link would be to use get_category_link and add_query_arg
In your example, the following would work:
$category_link = add_query_arg( array('paged' => 5), get_category_link($category->term_id));
This will generate the URL and Wordpress will redirect to the correct page.
check this page out, it explains pretty permalinks pretty good.
http://codex.wordpress.org/Using_Permalinks
You should find these settings in
Wordpress->Settings->Permalinks
I think
/%category%/%postname%
in the direction what you want
You can also try to redirect your url using htaccess, here are some examples:
[http://]perishablepress.com/press/2008/02/06/permalink-evolution-customize-and-optimize-your-dated-wordpress-permalinks/
Sorry darf bis jetzt nur ein link posten pfft... :-(
kind regards,
Mahatmanich

Resources