douhuan1380 2011-02-11 11:28
浏览 105
已采纳

Magento可配置产品属性

hey guys, having an issue with magento which i just cant seem to find a solution to.

i have tried many ways of getting a configurable products attributes (simple products) and listing them, now i have them listing from 2 ways but the way im working with is below

$confAttributes = @$_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product);

    $sizes = array();

    foreach($confAttributes AS $atts){
        //print '';//'<pre style="display:none;">'.print_r($atts).'</pre>';
        if($atts['label'] == 'Size'){

            foreach($atts['values'] AS $val){

                $sizes[] = $val['store_label']; 

            }   

        }

    }

my only problem with this now is i need to only pull back the size attributes which are in stock - looked through mage files to find solution but just cant see anything - the result i need is done in config product php file but i cant access it from in the code where i need to list the size attribute.

any help would be great, thanks!

  • 写回答

2条回答 默认 最新

  • duanhe7471 2011-02-11 13:05
    关注

    found the solution, i had to use the above what i had already coded and use assosicated products for the size and then check the stock levels and put them into an array and check the stock when building my attribute list - works great - anyone else have a better solution please share :D thanks

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?
  • ¥15 讲解电路图,付费求解
  • ¥15 有偿请教计算电磁学的问题涉及到空间中时域UTD和FDTD算法结合的
  • ¥15 three.js添加后处理以后模型锯齿化严重
  • ¥15 vite打包后,页面出现h.createElement is not a function,但本地运行正常