Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Please Help, Im sooo close
 
dudexsnave
Jr. Member
 
Total Posts:  10
Joined:  2009-04-30
 

Hi guys once again on my quest for a resolution to a brain smashing problem (it should be soooo simple)

a very helpful person on this forum who i have praised for his help gave me this

<?php if ($_product->getData('name_of_your_attribute')): ?> 
     <?php $_productURL
$_product->getResource()->getAttribute('name_of_your_attribute')->getFrontend()->getValue($_product); ?> 
     
<a href ="<?php echo $_productURL ?> ">Voila!</a>
<?php endif; ?>

I am trying to create a custom attribute so i can upload a special url along with my products (using mapping) that links to a different site (in this case the actual sellers site)
but i have a couple of issue im hoping you guys can help with.

1. when i look into the database there are so many tables, which table should i add this custom field to ???????

2. in testing i have noticed that this will not work, if you clicked this (we are going to assume the link i want is http://www.magento.com) the link would actually be http://magentostoreurl/magento/index/http://www.magento.com which obviously will not work.

Thanks Community grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

Your setup should work just fine. I have just tested what you are trying to do and it works for me. Here are the assumptions that I made to get this to work:
name_of_your_attribute: this is a full url, ie http://www.mydomain.com
location : category product list

Here’s what I did:
1. Created a new attribute: vendorurl, type:text
2. Added the attribute to my catalog.xml file. In catalog.xml, look for:

<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
Below it add:
<action method="addAttribute"><code>vendorurl</code></action>
Where vendorurl is obviously the name of the attribute that holds the url
3. Added the following to catalog/product/list.phtml:
<?php if ($_product->getVendorurl()): ?> 
     <?php $_productURL
$_product->getVendorurl(); ?> 
     
<a href ="<?php echo $_productURL ?> ">Voila!</a>
<?php endif; ?>

Since I added that attribute to the layout file, I can now call it directly. Tested and seems to work fine. I don’t know your setup or where you wanted to add the link, but the url attribute can be called pretty much anywhere with a bit of tweaking. Hope that helps.

Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
dudexsnave
Jr. Member
 
Total Posts:  10
Joined:  2009-04-30
 

That is such a fantastic help thanks so much guys!! grin

just one thing though, in which table do i add this field? I have looked into the database using mysql admin but there is just sooo many.

BTW, i am doing this on a fresh install for now so i can get to grips with it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dudexsnave
Jr. Member
 
Total Posts:  10
Joined:  2009-04-30
 

please forgive my dumb ass comments about which table to add to,
I am new to magento and have just found attribute manager.

coming from oscommerce where everyting is done manually you just expect it.

Ha Ha thanks guys

 
Magento Community Magento Community
Magento Community
Magento Community
 
cloudquarry
Guru
 
Avatar
Total Posts:  528
Joined:  2008-11-19
 

Glad you were able to get it to work dudexsnave! I recognize my original code from the “Voila!” and am happy this is finally working for you. ::grin::

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top