다시 정리해 볼게요
A라는 오픈소스 플그램 버전 1 을 쓰고있었어용
근데 거기서 코드를 좀 고쳐서 썻어요...
정확히 말하면 기존에 있는 코드를 지웟거나 바꾼건 없고, 기존에 있는거에 코드를 추가해서 썻어요..
밑에보면 보통 글씨가 원래 오리지날이고, 두껍고 큰 글씨가 추가된 부분이에용...
foreach ($results as $result) {
if ($result[\'image\'] && file_exists(DIR_IMAGE . $result[\'image\'])) {
$this->data[\'product_images\'][] = array(
\'preview\' => $this->model_tool_image->resize($result[\'image\'], 100, 100),
\'file\' => $result[\'image\'], \'product_color_id\' => $result[\'product_color_id\']
);
} else {
$this->data[\'product_images\'][] = array(
\'preview\' => $this->model_tool_image->resize(\'no_image.jpg\', 100, 100),
\'file\' => $result[\'image\'], \'product_color_id\' => $result[\'product_color_id\']
); } } } $this->data[\'product_colors\'] = array(); if (isset($product_info)) { $results = $this->model_catalog_product->getProductColors($this->request->get[\'product_id\']); foreach ($results as $result) { if ($result[\'color\'] && file_exists(DIR_IMAGE . $result[\'color\'])) { $this->data[\'product_colors\'][] = array( \'preview\' => $this->model_tool_image->resize($result[\'color\'], 30, 30), \'file\' => $result[\'color\'], \'product_color_id\' => $result[\'product_color_id\'], \'name\' => $result[\'name\'] ); } else { $this->data[\'product_colors\'][] = array( \'preview\' => $this->model_tool_image->resize(\'no_image.jpg\', 30, 30), \'file\' => $result[\'color\'], \'product_color_id\' => 0, \'name\' => \'\' );
}
}
}
$this->data[\'product_sizes\'] = array(); if (isset($product_info)) { $results = $this->model_catalog_product->getProductSizes($this->request->get[\'product_id\']); foreach ($results as $result) { $this->data[\'product_sizes\'][] = $result[\'size\']; }
}
그런데, 이 프로그램이 버전 2가 나왓어요...업그레이드를 하려는데 걍 업그래이드를 하면 저 위에 추가한 기능이 날라가 버려용 ㅠㅠ
그래서 제딴에 생각하기를, 아하! 어차피 코드가 추가된것 뿐이니, 파일을 열어서 같은 부분을 찾아서 같은 부위에 추가하면 되겟네!
라고 생각해서, 저 코드 부분을 찾아보았어요..그런데 버전 2에서는 저 부분이 다르게 코딩되어있는것이었어요..
요렇게...
foreach ($results as $result) {
$action = array();
$action[] = array(
\'text\' => $this->language->get(\'text_edit\'),
\'href\' => $this->url->link(\'catalog/product/update\', \'token=\' . $this->session->data[\'token\'] . \'&product_id=\' . $result[\'product_id\'] . $url, \'SSL\')
);
if ($result[\'image\'] && file_exists(DIR_IMAGE . $result[\'image\'])) {
$image = $this->model_tool_image->resize($result[\'image\'], 40, 40);
} else {
$image = $this->model_tool_image->resize(\'no_image.jpg\', 40, 40);
}
$product_specials = $this->model_catalog_product->getProductSpecials($result[\'product_id\']);
if ($product_specials) {
$special = reset($product_specials);
if(($special[\'date_start\'] != \'0000-00-00\' && $special[\'date_start\'] > date(\'Y-m-d\')) || ($special[\'date_end\'] != \'0000-00-00\' && $special[\'date_end\'] < date(\'Y-m-d\'))) {
$special = FALSE;
}
} else {
$special = FALSE;
}
$this->data[\'products\'][] = array(
\'product_id\' => $result[\'product_id\'],
\'name\' => $result[\'name\'],
\'model\' => $result[\'model\'],
\'cost\' => $result[\'cost\'],
\'special\' => $special[\'cost\'],
\'image\' => $image, \'quantity\' => $result[\'quantity\'],
\'status\' => ($result[\'status\'] ? $this->language->get(\'text_enabled\') : $this->language->get(\'text_disabled\')),
\'selected\' => isset($this->request->post[\'selected\']) && in_array($result[\'product_id\'], $this->request->post[\'selected\']),
\'action\' => $action
제가 php를 잘 몰라서 저 큰 글씨 부분이 무엇을 의미하는지 해석이 잘 안되서
새로운 버전의 코딩에 맞게 수정하는거 당연히 불가능해서요 ㅠㅠ
저 큰글씨 부분의 기능을 업뎃된 버전의 코딩에 맞게 해서 계속 쓰고 싶거든요..ㅠㅠ
도와주시면 정말 이쁜이쁜 배우자 만나실거에요..ㅠㅠ
불쌍한 처자하나좀 도와주세요 ㅠㅠ php 강의같은거 잘 되어있는데 어디 없나 흑흑 ㅜㅠ
상품 컬러 정보를 추가하고 싶은가 본데 뿌려주는 부분에서 딱히 바뀐게 없다면 $this->data[\'product_images\'], $this->data[\'product_colors\'], $this->data[\'product_sizes\'], 데이타 가져와서 던져주고 받으면 될 것 같은데??
솔직히 뿌려주고 던지고 받는다는 부분이 이해가 완벽히는 안가지만, 힌트로 여기고 이리저리 해봐야겟네요 ㅠㅠ
복받으실거에요 고마워요 정말!! ㅜㅜ