여기에 내 코드가 있습니다. 나는 제품의 전체 URL 경로가 다음 리디렉션 얻을 수 있지만, 문제는 :이 오류Magento 카테고리의 제품 URL
내 문제 매번이 코드를 수행하고 URL을 완료 리디렉션 "웹 페이지에 리디렉션 순환이"있어
,이 코드는 웹 페이지가 리다이렉트 루프를 가질 때까지 url이 리디렉션 할 때마다 실행됩니다.
사람이 내 문제에 저를 도울 수있다. 내가
내가 원하는 "루프를 리디렉션"오류를 가지고 때까지
사용자 액세스 http://www.url.com/product.html
는 다음이 URL http://www.url.com/category/product.html
로 리디렉션됩니다 URL을 예를 들어
URL에 범주가 있으면이 코드를 수행하지 않습니다.
$product_id = $this->getProduct()->getId();
$_product = Mage::getModel('catalog/product')->load($product_id);
if($_product->getStatus()==1){
$_categories = $_product->getCategoryIds();
$_category = Mage::getModel('catalog/category')->load($_categories[0]);
$url = $this->getUrl($_category->getUrlPath()).$_product->getUrlPath();
$url = str_replace(".html","" ,$url) . '.html';
header('Location: ' . $url);
die();
}
감사합니다.